Added handling of SCTP states PF and UNCONFIRMED if supported by the library.
git-svn-id: http://voip.null.ro/svn/yate@6249 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
d6d72562a5
commit
88277b60a0
17
configure.ac
17
configure.ac
|
@ -502,6 +502,23 @@ if [[ "x$sctp_assoc_value" = "xyes" ]]; then
|
|||
SCTP_FLAGS="$SCTP_FLAGS -DHAVE_ASSOC_VALUE_STRUCT"
|
||||
fi
|
||||
fi
|
||||
# Check for SCTP_UNCONFIRMED enum value presence
|
||||
# Added in lksctp-tools 1.0.7
|
||||
sctp_have_unconfirmed=no
|
||||
AC_MSG_CHECKING([whether SCTP_UNCONFIRMED is present])
|
||||
AC_TRY_COMPILE([#include <netinet/sctp.h>],[int val = SCTP_UNCONFIRMED;],[sctp_have_unconfirmed=yes])
|
||||
AC_MSG_RESULT([$sctp_have_unconfirmed])
|
||||
if [[ "x$sctp_have_unconfirmed" = "xyes" ]]; then
|
||||
SCTP_FLAGS="$SCTP_FLAGS -DHAVE_SCTP_UNCONFIRMED"
|
||||
fi
|
||||
# Check for SCTP_PF enum value presence
|
||||
sctp_have_pf=no
|
||||
AC_MSG_CHECKING([whether SCTP_PF is present])
|
||||
AC_TRY_COMPILE([#include <netinet/sctp.h>],[int val = SCTP_PF;],[sctp_have_pf=yes])
|
||||
AC_MSG_RESULT([$sctp_have_unconfirmed])
|
||||
if [[ "x$sctp_have_pf" = "xyes" ]]; then
|
||||
SCTP_FLAGS="$SCTP_FLAGS -DHAVE_SCTP_PF"
|
||||
fi
|
||||
else
|
||||
if [[ "x$HAVE_SCTP" != "xno" ]]; then
|
||||
SCTP_FLAGS="-DHAVE_SCTP"
|
||||
|
|
|
@ -500,17 +500,36 @@ bool LKSocket::alive() const
|
|||
case SCTP_SHUTDOWN_ACK_SENT:
|
||||
localUp = false;
|
||||
}
|
||||
localUp = localUp && status.sstat_primary.spinfo_state == SCTP_ACTIVE;
|
||||
if (localUp)
|
||||
if (localUp && (status.sstat_primary.spinfo_state == SCTP_ACTIVE
|
||||
#ifdef HAVE_SCTP_PF
|
||||
|| status.sstat_primary.spinfo_state == SCTP_PF
|
||||
#endif
|
||||
#ifdef HAVE_SCTP_UNCONFIRMED
|
||||
|| status.sstat_primary.spinfo_state == SCTP_UNCONFIRMED
|
||||
#endif
|
||||
))
|
||||
return true;
|
||||
#ifdef DEBUG
|
||||
#define MAKE_CASE(x,y) case SCTP_##x: \
|
||||
Debug(&plugin,DebugNote,"%s sctp status : SCTP_%s",#y,#x); \
|
||||
DDebug(&plugin,DebugNote,"%s sctp status : SCTP_%s",#y,#x); \
|
||||
break;
|
||||
static int s_lastSpinfoState = SCTP_ACTIVE;
|
||||
switch (status.sstat_primary.spinfo_state) {
|
||||
MAKE_CASE(ACTIVE,Remote);
|
||||
MAKE_CASE(INACTIVE,Remote);
|
||||
#ifdef HAVE_SCTP_PF
|
||||
MAKE_CASE(PF,Remote);
|
||||
#endif
|
||||
#ifdef HAVE_SCTP_UNCONFIRMED
|
||||
MAKE_CASE(UNCONFIRMED,Remote);
|
||||
#endif
|
||||
default:
|
||||
if (s_lastSpinfoState != status.sstat_primary.spinfo_state) {
|
||||
s_lastSpinfoState = status.sstat_primary.spinfo_state;
|
||||
Debug(&plugin,DebugNote,"Unknown SCTP remote state 0x0%x",
|
||||
status.sstat_primary.spinfo_state);
|
||||
}
|
||||
}
|
||||
static int s_lastSstatState = SCTP_EMPTY;
|
||||
switch (status.sstat_state) {
|
||||
MAKE_CASE(EMPTY,Local);
|
||||
MAKE_CASE(CLOSED,Local);
|
||||
|
@ -522,10 +541,13 @@ bool LKSocket::alive() const
|
|||
MAKE_CASE(SHUTDOWN_RECEIVED,Local);
|
||||
MAKE_CASE(SHUTDOWN_ACK_SENT,Local);
|
||||
default:
|
||||
Debug(&plugin,DebugNote,"Unknown SCTP local State : 0x0%x",status.sstat_state);
|
||||
if (s_lastSstatState != status.sstat_state) {
|
||||
s_lastSstatState = status.sstat_state;
|
||||
Debug(&plugin,DebugNote,"Unknown SCTP local state 0x0%x",
|
||||
status.sstat_state);
|
||||
}
|
||||
}
|
||||
#undef MAKE_CASE
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue