[Asterisk-code-review] pjproject bundled: Add 3 upstream patches (asterisk[master])

George Joseph asteriskteam at digium.com
Tue Apr 4 16:53:41 CDT 2017


George Joseph has uploaded a new change for review. ( https://gerrit.asterisk.org/5408 )

Change subject: pjproject_bundled: Add 3 upstream patches
......................................................................

pjproject_bundled: Add 3 upstream patches

0035-r5572-svn-backport-dialog-transaction-deadlock.patch
0036-r5573-svn-backport-ua-pjsua-transaction-deadlock.patch
0037-r5576-svn-backport-session-timer-crash.patch

Also removed the progress bar from wget download to stdout.

ASTERISK-26905 #close
Reported-by: Ross Beer

Change-Id: I268fb3cf71a3bb24283ff0d24bd8b03239d81256
---
M configure
M configure.ac
M include/asterisk/autoconfig.h.in
M res/res_pjsip/pjsip_distributor.c
M third-party/pjproject/configure.m4
A third-party/pjproject/patches/0035-r5572-svn-backport-dialog-transaction-deadlock.patch
A third-party/pjproject/patches/0036-r5573-svn-backport-ua-pjsua-transaction-deadlock.patch
A third-party/pjproject/patches/0037-r5576-svn-backport-session-timer-crash.patch
8 files changed, 363 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/08/5408/1

diff --git a/configure b/configure
index b27c94e..2a87d10 100755
--- a/configure
+++ b/configure
@@ -945,6 +945,10 @@
 POPT_DIR
 POPT_INCLUDE
 POPT_LIB
+PBX_PJSIP_TSX_LAYER_FIND_TSX2
+PJSIP_TSX_LAYER_FIND_TSX2_DIR
+PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE
+PJSIP_TSX_LAYER_FIND_TSX2_LIB
 PBX_PJSIP_EVSUB_SET_UAS_TIMEOUT
 PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR
 PJSIP_EVSUB_SET_UAS_TIMEOUT_INCLUDE
@@ -7912,7 +7916,7 @@
 
 if test "${WGET}" != ":" ; then
   DOWNLOAD=${WGET}
-  DOWNLOAD_TO_STDOUT="${WGET} -O-"
+  DOWNLOAD_TO_STDOUT="${WGET} -q -O-"
   DOWNLOAD_TIMEOUT='--timeout=$1'
 else if test "${CURL}" != ":" ; then
   DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
@@ -9354,6 +9358,9 @@
 
 
 $as_echo "#define HAVE_PJSIP_EVSUB_SET_UAS_TIMEOUT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_TSX_LAYER_FIND_TSX2 1" >>confdefs.h
 
 
 
@@ -11556,6 +11563,18 @@
 PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR=${PJPROJECT_DIR}
 
 PBX_PJSIP_EVSUB_SET_UAS_TIMEOUT=0
+
+
+
+
+
+
+
+PJSIP_TSX_LAYER_FIND_TSX2_DESCRIP="pjsip_tsx_layer_find_tsx2 support"
+PJSIP_TSX_LAYER_FIND_TSX2_OPTION=pjsip
+PJSIP_TSX_LAYER_FIND_TSX2_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_TSX_LAYER_FIND_TSX2=0
 
 
 
@@ -26739,6 +26758,110 @@
 fi
 
 
+
+if test "x${PBX_PJSIP_TSX_LAYER_FIND_TSX2}" != "x1" -a "${USE_PJSIP_TSX_LAYER_FIND_TSX2}" != "no"; then
+   pbxlibdir=""
+   # if --with-PJSIP_TSX_LAYER_FIND_TSX2=DIR has been specified, use it.
+   if test "x${PJSIP_TSX_LAYER_FIND_TSX2_DIR}" != "x"; then
+      if test -d ${PJSIP_TSX_LAYER_FIND_TSX2_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_TSX_LAYER_FIND_TSX2_DIR}/lib"
+      else
+         pbxlibdir="-L${PJSIP_TSX_LAYER_FIND_TSX2_DIR}"
+      fi
+   fi
+   pbxfuncname="pjsip_tsx_layer_find_tsx2"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_PJSIP_TSX_LAYER_FIND_TSX2_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS"
+      as_ac_Lib=`$as_echo "ac_cv_lib_pjsip_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpjsip" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpjsip... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
+int
+main ()
+{
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_PJSIP_TSX_LAYER_FIND_TSX2_FOUND=yes
+else
+  AST_PJSIP_TSX_LAYER_FIND_TSX2_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_PJSIP_TSX_LAYER_FIND_TSX2_FOUND}" = "yes"; then
+      PJSIP_TSX_LAYER_FIND_TSX2_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
+      # if --with-PJSIP_TSX_LAYER_FIND_TSX2=DIR has been specified, use it.
+      if test "x${PJSIP_TSX_LAYER_FIND_TSX2_DIR}" != "x"; then
+         PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE="-I${PJSIP_TSX_LAYER_FIND_TSX2_DIR}/include"
+      fi
+      PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE="${PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE} $PJPROJECT_CFLAGS"
+      if test "xpjsip.h" = "x" ; then	# no header, assume found
+         PJSIP_TSX_LAYER_FIND_TSX2_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "pjsip.h" "ac_cv_header_pjsip_h" "$ac_includes_default"
+if test "x$ac_cv_header_pjsip_h" = xyes; then :
+  PJSIP_TSX_LAYER_FIND_TSX2_HEADER_FOUND=1
+else
+  PJSIP_TSX_LAYER_FIND_TSX2_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${PJSIP_TSX_LAYER_FIND_TSX2_HEADER_FOUND}" = "x0" ; then
+         PJSIP_TSX_LAYER_FIND_TSX2_LIB=""
+         PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            PJSIP_TSX_LAYER_FIND_TSX2_LIB=""
+         fi
+         PBX_PJSIP_TSX_LAYER_FIND_TSX2=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_PJSIP_TSX_LAYER_FIND_TSX2 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
    fi
 fi
 
diff --git a/configure.ac b/configure.ac
index b0f0488..d04d369 100644
--- a/configure.ac
+++ b/configure.ac
@@ -293,7 +293,7 @@
 
 if test "${WGET}" != ":" ; then
   DOWNLOAD=${WGET}
-  DOWNLOAD_TO_STDOUT="${WGET} -O-"
+  DOWNLOAD_TO_STDOUT="${WGET} -q -O-"
   DOWNLOAD_TIMEOUT='--timeout=$1'
 else if test "${CURL}" != ":" ; then
   DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
@@ -519,6 +519,7 @@
 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_SESSION_REF], [PJSIP INVITE Session Reference Count support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_AUTH_CLT_DEINIT], [pjsip_auth_clt_deinit support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_EVSUB_SET_UAS_TIMEOUT], [PJSIP EVSUB Set UAS Timeout support], [PJPROJECT], [pjsip])
+AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip_tsx_layer_find_tsx2 support], [PJPROJECT], [pjsip])
 fi
 
 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
@@ -2221,6 +2222,7 @@
       AST_EXT_LIB_CHECK([PJSIP_INV_SESSION_REF], [pjsip], [pjsip_inv_add_ref], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
       AST_EXT_LIB_CHECK([PJSIP_AUTH_CLT_DEINIT], [pjsip], [pjsip_auth_clt_deinit], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
       AST_EXT_LIB_CHECK([PJSIP_EVSUB_SET_UAS_TIMEOUT], [pjsip], [pjsip_evsub_set_uas_timeout], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
+      AST_EXT_LIB_CHECK([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip], [pjsip_tsx_layer_find_tsx2], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    fi
 fi
 
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index b9b4e1f..5446b01 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -618,6 +618,10 @@
 /* Define if your system has the PJSIP_TLS_TRANSPORT_PROTO headers. */
 #undef HAVE_PJSIP_TLS_TRANSPORT_PROTO
 
+/* Define to 1 if PJPROJECT has the pjsip_tsx_layer_find_tsx2 support feature.
+   */
+#undef HAVE_PJSIP_TSX_LAYER_FIND_TSX2
+
 /* Define to 1 if PJPROJECT has the pj_ssl_cert_load_from_files2 support
    feature. */
 #undef HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2
diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c
index cca26a8..e92fd5b 100644
--- a/res/res_pjsip/pjsip_distributor.c
+++ b/res/res_pjsip/pjsip_distributor.c
@@ -117,7 +117,11 @@
 	pjsip_tsx_create_key(rdata->tp_info.pool, &tsx_key, PJSIP_ROLE_UAC,
 		&rdata->msg_info.cseq->method, rdata);
 
+#ifdef PJSIP_TSX_LAYER_FIND_TSX2
+	tsx = pjsip_tsx_layer_find_tsx2(&tsx_key, PJ_TRUE);
+#else
 	tsx = pjsip_tsx_layer_find_tsx(&tsx_key, PJ_TRUE);
+#endif
 	if (!tsx) {
 		ast_debug(1, "Could not find transaction for %s.\n",
 			pjsip_rx_data_get_info(rdata));
@@ -260,7 +264,11 @@
 				&rdata->msg_info.cseq->method, rdata);
 	}
 
+#ifdef PJSIP_TSX_LAYER_FIND_TSX2
+	tsx = pjsip_tsx_layer_find_tsx2(&tsx_key, PJ_TRUE);
+#else
 	tsx = pjsip_tsx_layer_find_tsx(&tsx_key, PJ_TRUE);
+#endif
 	if (!tsx) {
 		ast_debug(3, "Could not find matching transaction for %s\n",
 			pjsip_rx_data_get_info(rdata));
diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4
index d5c8531..84a51ac 100644
--- a/third-party/pjproject/configure.m4
+++ b/third-party/pjproject/configure.m4
@@ -63,6 +63,7 @@
 	AC_DEFINE([HAVE_PJSIP_INV_SESSION_REF], 1, [Define if your system has PJSIP_INV_SESSION_REF])
 	AC_DEFINE([HAVE_PJSIP_AUTH_CLT_DEINIT], 1, [Define if your system has pjsip_auth_clt_deinit declared.])
 	AC_DEFINE([HAVE_PJSIP_EVSUB_SET_UAS_TIMEOUT], 1, [Define if your system has pjsip_evsub_set_uas_timeout declared.])
+	AC_DEFINE([HAVE_PJSIP_TSX_LAYER_FIND_TSX2], 1, [Define if your system has pjsip_evsub_set_uas_timeout declared.])
 
 	AC_SUBST([PJPROJECT_BUNDLED])
 	AC_SUBST([PJPROJECT_DIR])
diff --git a/third-party/pjproject/patches/0035-r5572-svn-backport-dialog-transaction-deadlock.patch b/third-party/pjproject/patches/0035-r5572-svn-backport-dialog-transaction-deadlock.patch
new file mode 100644
index 0000000..0c5e986
--- /dev/null
+++ b/third-party/pjproject/patches/0035-r5572-svn-backport-dialog-transaction-deadlock.patch
@@ -0,0 +1,32 @@
+Index: trunk/pjsip/src/pjsip/sip_transaction.c
+===================================================================
+--- a/pjsip/src/pjsip/sip_transaction.c	(revision 5244)
++++ b/pjsip/src/pjsip/sip_transaction.c	(revision 5572)
+@@ -1231,5 +1231,27 @@
+ 	PJSIP_EVENT_INIT_TSX_STATE(e, tsx, event_src_type, event_src,
+ 				   prev_state);
++
++	/* For timer event, release lock to avoid deadlock.
++	 * This should be safe because:
++	 * 1. The tsx state just switches to TERMINATED or DESTROYED.
++  	 * 2. There should be no other processing taking place. All other
++  	 *    events, such as the ones handled by tsx_on_state_terminated()
++  	 *    should be ignored.
++         * 3. tsx_shutdown() hasn't been called.
++	 * Refer to ticket #2001 (https://trac.pjsip.org/repos/ticket/2001).
++	 */
++	if (event_src_type == PJSIP_EVENT_TIMER &&
++	    (pj_timer_entry *)event_src == &tsx->timeout_timer)
++	{
++	    pj_grp_lock_release(tsx->grp_lock);
++	}
++
+ 	(*tsx->tsx_user->on_tsx_state)(tsx, &e);
++
++	if (event_src_type == PJSIP_EVENT_TIMER &&
++	    (pj_timer_entry *)event_src == &tsx->timeout_timer)
++	{
++	    pj_grp_lock_acquire(tsx->grp_lock);
++	}
+     }
+     
diff --git a/third-party/pjproject/patches/0036-r5573-svn-backport-ua-pjsua-transaction-deadlock.patch b/third-party/pjproject/patches/0036-r5573-svn-backport-ua-pjsua-transaction-deadlock.patch
new file mode 100644
index 0000000..5887380
--- /dev/null
+++ b/third-party/pjproject/patches/0036-r5573-svn-backport-ua-pjsua-transaction-deadlock.patch
@@ -0,0 +1,119 @@
+Index: trunk/pjsip/include/pjsip/sip_transaction.h
+===================================================================
+--- a/pjsip/include/pjsip/sip_transaction.h	(revision 5572)
++++ b/pjsip/include/pjsip/sip_transaction.h	(revision 5573)
+@@ -180,4 +180,8 @@
+  * is created by calling #pjsip_tsx_create_key() from an incoming message.
+  *
++ * IMPORTANT: To prevent deadlock, application should use
++ * #pjsip_tsx_layer_find_tsx2() instead which only adds a reference to
++ * the transaction instead of locking it.
++ *
+  * @param key	    The key string to find the transaction.
+  * @param lock	    If non-zero, transaction will be locked before the
+@@ -190,4 +194,19 @@
+ PJ_DECL(pjsip_transaction*) pjsip_tsx_layer_find_tsx( const pj_str_t *key,
+ 						      pj_bool_t lock );
++
++/**
++ * Find a transaction with the specified key. The transaction key normally
++ * is created by calling #pjsip_tsx_create_key() from an incoming message.
++ *
++ * @param key	    The key string to find the transaction.
++ * @param add_ref   If non-zero, transaction's reference will be added
++ *		    by one before the function returns, to make sure that
++ * 		    it's not deleted by other threads.
++ *
++ * @return	    The matching transaction instance, or NULL if transaction
++ *		    can not be found.
++ */
++PJ_DECL(pjsip_transaction*) pjsip_tsx_layer_find_tsx2( const pj_str_t *key,
++						       pj_bool_t add_ref );
+ 
+ /**
+Index: trunk/pjsip/src/pjsip/sip_transaction.c
+===================================================================
+--- a/pjsip/src/pjsip/sip_transaction.c	(revision 5572)
++++ b/pjsip/src/pjsip/sip_transaction.c	(revision 5573)
+@@ -642,6 +642,6 @@
+  * Find a transaction.
+  */
+-PJ_DEF(pjsip_transaction*) pjsip_tsx_layer_find_tsx( const pj_str_t *key,
+-						     pj_bool_t lock )
++static pjsip_transaction* find_tsx( const pj_str_t *key, pj_bool_t lock,
++				    pj_bool_t add_ref )
+ {
+     pjsip_transaction *tsx;
+@@ -655,5 +655,5 @@
+     /* Prevent the transaction to get deleted before we have chance to lock it.
+      */
+-    if (tsx && lock)
++    if (tsx)
+         pj_grp_lock_add_ref(tsx->grp_lock);
+     
+@@ -667,10 +667,27 @@
+     PJ_RACE_ME(5);
+ 
+-    if (tsx && lock) {
+-	pj_grp_lock_acquire(tsx->grp_lock);
+-        pj_grp_lock_dec_ref(tsx->grp_lock);
++    if (tsx) {
++	if (lock)
++	    pj_grp_lock_acquire(tsx->grp_lock);
++
++        if (!add_ref)
++            pj_grp_lock_dec_ref(tsx->grp_lock);
+     }
+ 
+     return tsx;
++}
++
++
++PJ_DEF(pjsip_transaction*) pjsip_tsx_layer_find_tsx( const pj_str_t *key,
++						     pj_bool_t lock )
++{
++    return find_tsx(key, lock, PJ_FALSE);
++}
++
++
++PJ_DEF(pjsip_transaction*) pjsip_tsx_layer_find_tsx2( const pj_str_t *key,
++						      pj_bool_t add_ref )
++{
++    return find_tsx(key, PJ_FALSE, add_ref);
+ }
+ 
+Index: trunk/pjsip/src/pjsip/sip_ua_layer.c
+===================================================================
+--- a/pjsip/src/pjsip/sip_ua_layer.c	(revision 5572)
++++ b/pjsip/src/pjsip/sip_ua_layer.c	(revision 5573)
+@@ -552,10 +552,10 @@
+ 
+ 	/* Lookup the INVITE transaction */
+-	tsx = pjsip_tsx_layer_find_tsx(&key, PJ_TRUE);
++	tsx = pjsip_tsx_layer_find_tsx2(&key, PJ_TRUE);
+ 
+ 	/* We should find the dialog attached to the INVITE transaction */
+ 	if (tsx) {
+ 	    dlg = (pjsip_dialog*) tsx->mod_data[mod_ua.mod.id];
+-	    pj_grp_lock_release(tsx->grp_lock);
++	    pj_grp_lock_dec_ref(tsx->grp_lock);
+ 
+ 	    /* Dlg may be NULL on some extreme condition
+Index: trunk/pjsip/src/pjsip-ua/sip_inv.c
+===================================================================
+--- a/pjsip/src/pjsip-ua/sip_inv.c	(revision 5572)
++++ b/pjsip/src/pjsip-ua/sip_inv.c	(revision 5573)
+@@ -3276,5 +3276,5 @@
+     pjsip_tsx_create_key(rdata->tp_info.pool, &key, PJSIP_ROLE_UAS,
+ 			 pjsip_get_invite_method(), rdata);
+-    invite_tsx = pjsip_tsx_layer_find_tsx(&key, PJ_TRUE);
++    invite_tsx = pjsip_tsx_layer_find_tsx2(&key, PJ_TRUE);
+ 
+     if (invite_tsx == NULL) {
+@@ -3325,5 +3325,5 @@
+ 
+     if (invite_tsx)
+-	pj_grp_lock_release(invite_tsx->grp_lock);
++	pj_grp_lock_dec_ref(invite_tsx->grp_lock);
+ }
+ 
diff --git a/third-party/pjproject/patches/0037-r5576-svn-backport-session-timer-crash.patch b/third-party/pjproject/patches/0037-r5576-svn-backport-session-timer-crash.patch
new file mode 100644
index 0000000..098adcd
--- /dev/null
+++ b/third-party/pjproject/patches/0037-r5576-svn-backport-session-timer-crash.patch
@@ -0,0 +1,72 @@
+Index: pjproject/trunk/pjsip/src/pjsip-ua/sip_timer.c
+===================================================================
+--- a/pjsip/src/pjsip-ua/sip_timer.c	(revision 5557)
++++ b/pjsip/src/pjsip-ua/sip_timer.c	(revision 5576)
+@@ -333,6 +333,8 @@
+     pjsip_tx_data *tdata = NULL;
+     pj_status_t status;
+     pj_bool_t as_refresher;
++    int entry_id;
++    char obj_name[PJ_MAX_OBJ_NAME];
+ 
+     pj_assert(inv);
+ 
+@@ -344,7 +346,10 @@
+     /* Check our role */
+     as_refresher =
+ 	(inv->timer->refresher == TR_UAC && inv->timer->role == PJSIP_ROLE_UAC) ||
+-	(inv->timer->refresher == TR_UAS && inv->timer->role == PJSIP_ROLE_UAS);    
++	(inv->timer->refresher == TR_UAS && inv->timer->role == PJSIP_ROLE_UAS);
++
++    entry_id = entry->id;
++    pj_ansi_strncpy(obj_name, inv->pool->obj_name, PJ_MAX_OBJ_NAME);
+ 
+     /* Do action based on role(refresher or refreshee). 
+      * As refresher:
+@@ -353,7 +358,7 @@
+      * As refreshee:
+      * - end session if there is no refresh request received.
+      */
+-    if (as_refresher && (entry->id != REFRESHER_EXPIRE_TIMER_ID)) {
++    if (as_refresher && (entry_id != REFRESHER_EXPIRE_TIMER_ID)) {
+ 	pj_time_val now;
+ 
+ 	/* As refresher, reshedule the refresh request on the following:
+@@ -414,7 +419,7 @@
+ 	}
+ 
+ 	pj_gettimeofday(&now);
+-	PJ_LOG(4, (inv->pool->obj_name,
++	PJ_LOG(4, (obj_name,
+ 		   "Refreshing session after %ds (expiration period=%ds)",
+ 		   (now.sec-inv->timer->last_refresh.sec),
+ 		   inv->timer->setting.sess_expires));
+@@ -432,7 +437,7 @@
+ 				       NULL, &tdata);
+ 
+ 	pj_gettimeofday(&now);
+-	PJ_LOG(3, (inv->pool->obj_name, 
++	PJ_LOG(3, (obj_name,
+ 		   "No session %s received after %ds "
+ 		   "(expiration period=%ds), stopping session now!",
+ 		   (as_refresher?"refresh response":"refresh"),
+@@ -451,11 +456,16 @@
+ 	status = pjsip_inv_send_msg(inv, tdata);	
+     }
+ 
++    /*
++     * At this point, dialog might have already been destroyed,
++     * including its pool used by the invite session.
++     */
++
+     /* Print error message, if any */
+     if (status != PJ_SUCCESS) {
+-	PJ_PERROR(2, (inv->pool->obj_name, status,
++	PJ_PERROR(2, (obj_name, status,
+ 		     "Error in %s session timer",
+-		     ((as_refresher && entry->id != REFRESHER_EXPIRE_TIMER_ID)? 
++		     ((as_refresher && entry_id != REFRESHER_EXPIRE_TIMER_ID)?
+ 		       "refreshing" : "terminating")));
+     }
+ }
+  

-- 
To view, visit https://gerrit.asterisk.org/5408
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I268fb3cf71a3bb24283ff0d24bd8b03239d81256
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>



More information about the asterisk-code-review mailing list