[Pkg-voip-commits] [pjproject] 01/06: get rid of git-dpm

Bernhard Schmidt berni at moszumanska.debian.org
Fri Dec 16 15:11:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

berni pushed a commit to branch master
in repository pjproject.

commit d60dcd80e32381fce83c3c02cbd7caed92ab0c5d
Author: Bernhard Schmidt <berni at debian.org>
Date:   Thu Dec 8 12:17:23 2016 +0100

    get rid of git-dpm
---
 Makefile                                 |  1 -
 aconfigure.ac                            | 35 ++++--------
 build.mak.in                             | 17 ++----
 debian/.git-dpm                          |  8 ---
 pjlib-util/build/Makefile                |  4 +-
 pjlib-util/src/pjlib-util/resolver.c     | 52 ++++++++---------
 pjlib-util/src/pjlib-util/srv_resolver.c | 17 +-----
 pjlib/build/Makefile                     |  2 +-
 pjlib/src/pj/sock_bsd.c                  |  4 --
 pjlib/src/pj/ssl_sock_ossl.c             | 66 ++++++++--------------
 pjmedia/build/Makefile                   |  4 --
 pjnath/build/Makefile                    |  5 +-
 pjsip/build/Makefile                     |  2 +-
 pjsip/include/pjsip-simple/evsub.h       |  3 +-
 pjsip/include/pjsip-ua/sip_inv.h         | 30 ----------
 pjsip/include/pjsip/sip_endpoint.h       |  3 +-
 pjsip/src/pjsip-simple/evsub.c           |  4 +-
 pjsip/src/pjsip-ua/sip_inv.c             | 95 +++++++-------------------------
 pjsip/src/pjsip/sip_dialog.c             | 18 ++++--
 pjsip/src/pjsip/sip_endpoint.c           |  1 -
 pjsip/src/pjsip/sip_resolve.c            | 14 ++---
 pjsip/src/pjsip/sip_transport.c          |  9 +--
 22 files changed, 116 insertions(+), 278 deletions(-)

diff --git a/Makefile b/Makefile
index 1dfac1f..20af077 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,6 @@ include build/host-$(HOST_NAME).mak
 include version.mak
 
 LIB_DIRS = pjlib/build pjlib-util/build pjnath/build third_party/build pjmedia/build pjsip/build
-EXTRA_DIRS = pjsip-apps/src/python
 DIRS = $(LIB_DIRS) pjsip-apps/build $(EXTRA_DIRS)
 
 ifdef MINSIZE
diff --git a/aconfigure.ac b/aconfigure.ac
index 1f847fa..3c80efa 100644
--- a/aconfigure.ac
+++ b/aconfigure.ac
@@ -113,13 +113,7 @@ AC_CHECK_LIB(winmm,puts)
 AC_CHECK_LIB(socket,puts)
 AC_CHECK_LIB(rt,puts)
 AC_CHECK_LIB(m,sin)
-AC_SUBST(PJLIB_EXT)
-AC_SUBST(PJLIB_UTIL_EXT)
-AC_SUBST(PJMEDIA_EXT)
-AC_SUBST(PJMEDIA_CODEC_EXT)
-AC_SUBST(PJMEDIA_VIDEODEV_EXT)
-AC_SUBST(PJNATH_EXT)
-AC_CHECK_LIB(uuid,uuid_generate,[PJLIB_EXT="-luuid $PJLIB_EXT"])
+AC_CHECK_LIB(uuid,uuid_generate)
 AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
 AC_SEARCH_LIBS(gethostbyname,nsl)
 
@@ -690,7 +684,9 @@ else
 	dnl # Check if ALSA is available
 	ac_pjmedia_snd=alsa
 	AC_SUBST(ac_pa_use_alsa,1)
-	AC_CHECK_HEADER(alsa/version.h, [], [ac_pa_use_alsa=0])
+	AC_CHECK_HEADER(alsa/version.h,
+			[LIBS="$LIBS -lasound"],
+		        [ac_pa_use_alsa=0])
 	AC_MSG_RESULT([Checking sound device backend... unix])
 
 	dnl # Check if OSS is disabled
@@ -1007,9 +1003,7 @@ AC_ARG_ENABLE(sdl,
 			ac_sdl_cflags=`$SDL_CONFIG --cflags`
 			ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
 			ac_sdl_ldflags=`$SDL_CONFIG --libs`
-			PJLIB_UTIL_EXT="$PJLIB_UTIL_EXT $ac_sdl_ldflags"
-			PJMEDIA_VIDEODEV_EXT="$PJMEDIA_VIDEODEV_EXT $ac_sdl_ldflags"
-			PJNATH_EXT="$PJNATH_EXT $ac_sdl_ldflags"
+			LIBS="$LIBS $ac_sdl_ldflags"
 		  else
 			AC_MSG_RESULT([Unsupported SDL version])
 		  fi
@@ -1148,11 +1142,7 @@ AC_ARG_ENABLE(ffmpeg,
 			       [[#include <libavformat/avformat.h>]]
 			     )
 				     
-		PJLIB_UTIL_EXT="$PJLIB_UTIL_EXT $ac_ffmpeg_ldflags"
-		PJMEDIA_EXT="$PJMEDIA_EXT $ac_ffmpeg_ldflags"
-		PJMEDIA_CODEC_EXT="$PJMEDIA_CODEC_EXT $ac_ffmpeg_ldflags"
-		# FIXME: only needs libavutil
-		PJNATH_EXT="$PJNATH_EXT $ac_ffmpeg_ldflags"
+		LIBS="$LIBS $ac_ffmpeg_ldflags"
 		export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
 	      ]
 	      )
@@ -1173,10 +1163,7 @@ AC_ARG_ENABLE(v4l2,
 			     v4l2_open,
 			     [ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
 			      ac_v4l2_ldflags="-lv4l2"
-			      PJLIB_UTIL_EXT="$PJLIB_UTIL_EXT -lv4l2"
-			      PJMEDIA_VIDEODEV_EXT="$PJMEDIA_VIDEODEV_EXT -lv4l2"
-			      PJNATH_EXT="$PJNATH_EXT -lv4l2"
-
+			      LIBS="$LIBS -lv4l2"
 			     ]
 			     )
 	      ])
@@ -1600,8 +1587,8 @@ AC_ARG_ENABLE(ssl,
 		AC_SUBST(libssl_present)
 		AC_SUBST(libcrypto_present)
 		AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
-		AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && PJLIB_EXT="-lcrypto $PJLIB_EXT"])
-		AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && PJLIB_EXT="-lssl $PJLIB_EXT"])
+		AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="-lcrypto $LIBS"])
+		AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="-lssl $LIBS"])
 		if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
 	        	AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
 			# PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
@@ -1678,7 +1665,7 @@ AC_ARG_ENABLE(opencore_amr,
 		AC_SUBST(opencore_amrnb_h_present)
 		AC_SUBST(opencore_amrnb_present)
 		AC_CHECK_HEADER(opencore-amrnb/interf_enc.h,[opencore_amrnb_h_present=1])
-		AC_CHECK_LIB(opencore-amrnb,Encoder_Interface_init,[opencore_amrnb_present=1 && PJLIB_UTIL_EXT="$PJLIB_UTIL_EXT -lopencore-amrnb" && PJNATH_EXT="$PJNATH_EXT -lopencore-amrnb" ])
+		AC_CHECK_LIB(opencore-amrnb,Encoder_Interface_init,[opencore_amrnb_present=1 && LIBS="$LIBS -lopencore-amrnb"])
 		if test "x$opencore_amrnb_h_present" = "x1" -a "x$opencore_amrnb_present" = "x1"; then
 	        	AC_MSG_RESULT([OpenCORE AMR-NB library found, AMR-NB support enabled])
 	        	AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,1)
@@ -1692,7 +1679,7 @@ AC_ARG_ENABLE(opencore_amr,
 		AC_SUBST(opencore_amrwb_dec_present)
 		AC_CHECK_HEADER(vo-amrwbenc/enc_if.h,[opencore_amrwb_enc_h_present=1])
 		AC_CHECK_HEADER(opencore-amrwb/dec_if.h,[opencore_amrwb_dec_h_present=1])
-		AC_CHECK_LIB(opencore-amrwb,D_IF_init,[opencore_amrwb_dec_present=1 && PJLIB_UTIL_EXT="$PJLIB_UTIL_EXT -lopencore-amrnb" && PJNATH_EXT="$PJNATH_EXT -lopencore-amrwb" ])
+		AC_CHECK_LIB(opencore-amrwb,D_IF_init,[opencore_amrwb_dec_present=1 && LIBS="$LIBS -lopencore-amrwb"])
 		AC_CHECK_LIB(vo-amrwbenc,E_IF_init,[opencore_amrwb_enc_present=1 && LIBS="$LIBS -lvo-amrwbenc"])
 		if test "x$opencore_amrwb_enc_h_present" = "x1" -a "x$opencore_amrwb_dec_h_present" = "x1" -a "x$opencore_amrwb_enc_present" = "x1" -a "x$opencore_amrwb_dec_present" = "x1"; then
 	        	AC_MSG_RESULT([OpenCORE AMR-WB library found, AMR-WB support enabled])
diff --git a/build.mak.in b/build.mak.in
index cf09e4a..802211c 100644
--- a/build.mak.in
+++ b/build.mak.in
@@ -28,13 +28,6 @@ export APP_THIRD_PARTY_EXT :=
 export APP_THIRD_PARTY_LIBS :=
 export APP_THIRD_PARTY_LIB_FILES :=
 
-PJLIB_EXT = @PJLIB_EXT@
-PJLIB_UTIL_EXT = @PJLIB_UTIL_EXT@
-PJMEDIA_EXT = @PJMEDIA_EXT@
-PJMEDIA_CODEC_EXT = @PJMEDIA_CODEC_EXT@
-PJMEDIA_VIDEODEV_EXT = @PJMEDIA_VIDEODEV_EXT@
-PJNATH_EXT = @PJNATH_EXT@
-
 ifeq (@ac_external_srtp@,1)
 # External SRTP library
 APP_THIRD_PARTY_EXT += -lsrtp
@@ -67,7 +60,7 @@ endif
 ifneq (@ac_no_gsm_codec@,1)
 ifeq (@ac_external_gsm@,1)
 # External GSM library
-PJMEDIA_CODEC_EXT += -lgsm
+APP_THIRD_PARTY_EXT += -lgsm
 else
 APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libgsmcodec-$(LIB_SUFFIX)
 ifeq ($(PJ_SHARED_LIBRARIES),)
@@ -81,8 +74,7 @@ endif
 
 ifneq (@ac_no_speex_codec@,1)
 ifeq (@ac_external_speex@,1)
-PJMEDIA_EXT += -lspeexdsp
-PJMEDIA_CODEC_EXT += -lspeex
+APP_THIRD_PARTY_EXT += -lspeex -lspeexdsp
 else
 APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libspeex-$(LIB_SUFFIX)
 ifeq ($(PJ_SHARED_LIBRARIES),)
@@ -117,7 +109,7 @@ endif
 ifneq ($(findstring pa, at ac_pjmedia_snd@),)
 ifeq (@ac_external_pa@,1)
 # External PA
-PJMEDIA_AUDIODEV_EXT += -lportaudio
+APP_THIRD_PARTY_EXT += -lportaudio
 else
 APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio-$(LIB_SUFFIX)
 ifeq ($(PJ_SHARED_LIBRARIES),)
@@ -204,6 +196,7 @@ export APP_LDFLAGS := -L$(PJDIR)/pjlib/lib\
 	-L$(PJDIR)/pjmedia/lib\
 	-L$(PJDIR)/pjsip/lib\
 	-L$(PJDIR)/third_party/lib\
+	$(PJ_VIDEO_LDFLAGS) \
 	@LDFLAGS@
 export APP_LDXXFLAGS := $(APP_LDFLAGS)
 
@@ -265,7 +258,7 @@ export ADD_LIB_FILES := $(PJ_DIR)/pjsip/lib/libpjsua.$(SHLIB_SUFFIX).$(PJ_VERSIO
 
 APP_LIB_FILES += $(ADD_LIB_FILES)
 
-APP_LIBXX_FILES += $(PJ_DIR)/pjsip/lib/libpjsua2.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR)v5 $(PJ_DIR)/pjsip/lib/libpjsua2.$(SHLIB_SUFFIX) \
+APP_LIBXX_FILES += $(PJ_DIR)/pjsip/lib/libpjsua2.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/pjsip/lib/libpjsua2.$(SHLIB_SUFFIX) \
 	$(ADD_LIB_FILES)
 endif
 
diff --git a/debian/.git-dpm b/debian/.git-dpm
deleted file mode 100644
index f34e1da..0000000
--- a/debian/.git-dpm
+++ /dev/null
@@ -1,8 +0,0 @@
-# see git-dpm(1) from git-dpm package
-7a07460e75b42f2a8f02381a88140491d1703b94
-7a07460e75b42f2a8f02381a88140491d1703b94
-1047e1c8eed5013605500b204449cbe1e3668430
-1047e1c8eed5013605500b204449cbe1e3668430
-pjproject_2.5.5~dfsg.orig.tar.bz2
-d130318466a02e5734b069ed0e343a5d78c06a5c
-3506099
diff --git a/pjlib-util/build/Makefile b/pjlib-util/build/Makefile
index 56bc055..cb601cb 100644
--- a/pjlib-util/build/Makefile
+++ b/pjlib-util/build/Makefile
@@ -28,7 +28,7 @@ export _CFLAGS 	:= $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
 		   $(CFLAGS) $(CC_INC)../include $(CC_INC)../../pjlib/include
 export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
 		   $(HOST_CXXFLAGS) $(CXXFLAGS)
-export _LDFLAGS := $(CC_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
+export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
 		   $(APP_LDFLAGS) $(LDFLAGS)
 
 ###############################################################################
@@ -43,7 +43,7 @@ export PJLIB_UTIL_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
 		stun_simple_client.o xml.o
 export PJLIB_UTIL_CFLAGS += $(_CFLAGS)
 export PJLIB_UTIL_CXXFLAGS += $(_CXXFLAGS)
-export PJLIB_UTIL_LDFLAGS += $(PJLIB_LDLIB) $(PJLIB_UTIL_EXT) $(_LDFLAGS)
+export PJLIB_UTIL_LDFLAGS += $(PJLIB_LDLIB) $(_LDFLAGS)
 
 ###############################################################################
 # Defines for building test application
diff --git a/pjlib-util/src/pjlib-util/resolver.c b/pjlib-util/src/pjlib-util/resolver.c
index 365772e..ff4a199 100644
--- a/pjlib-util/src/pjlib-util/resolver.c
+++ b/pjlib-util/src/pjlib-util/resolver.c
@@ -835,7 +835,7 @@ PJ_DEF(pj_status_t) pj_dns_resolver_start_query( pj_dns_resolver *resolver,
     pj_time_val now;
     struct res_key key;
     struct cached_res *cache;
-    pj_dns_async_query *q, *p_q = NULL;
+    pj_dns_async_query *q;
     pj_uint32_t hval;
     pj_status_t status = PJ_SUCCESS;
 
@@ -849,6 +849,9 @@ PJ_DEF(pj_status_t) pj_dns_resolver_start_query( pj_dns_resolver *resolver,
     /* Check type */
     PJ_ASSERT_RETURN(type > 0 && type < 0xFFFF, PJ_EINVAL);
 
+    if (p_query)
+	*p_query = NULL;
+
     /* Build resource key for looking up hash tables */
     init_res_key(&key, type, name);
 
@@ -908,13 +911,7 @@ PJ_DEF(pj_status_t) pj_dns_resolver_start_query( pj_dns_resolver *resolver,
 	    /* Must return PJ_SUCCESS */
 	    status = PJ_SUCCESS;
 
-	    /*
-	     * We cannot write to *p_query after calling cb because what
-	     * p_query points to may have been freed by cb.
-             * Refer to ticket #1974.
-	     */
-	    pj_mutex_unlock(resolver->mutex);
-	    return status;
+	    goto on_return;
 	}
 
 	/* At this point, we have a cached entry, but this entry has expired.
@@ -946,7 +943,6 @@ PJ_DEF(pj_status_t) pj_dns_resolver_start_query( pj_dns_resolver *resolver,
 	/* Done. This child query will be notified once the "parent"
 	 * query completes.
 	 */
-	p_q = nq;
 	status = PJ_SUCCESS;
 	goto on_return;
     } 
@@ -974,12 +970,10 @@ PJ_DEF(pj_status_t) pj_dns_resolver_start_query( pj_dns_resolver *resolver,
     pj_hash_set_np(resolver->hquerybyres, &q->key, sizeof(q->key),
 		   0, q->hbufkey, q);
 
-    p_q = q;
-
-on_return:
     if (p_query)
-	*p_query = p_q;
+	*p_query = q;
 
+on_return:
     pj_mutex_unlock(resolver->mutex);
     return status;
 }
@@ -1369,7 +1363,8 @@ static void report_nameserver_status(pj_dns_resolver *resolver,
 	q_id = (pj_uint32_t)-1;
     }
 
-    if (!pkt || rcode == PJ_DNS_RCODE_REFUSED ||
+    if (!pkt || rcode == PJ_DNS_RCODE_SERVFAIL ||
+	        rcode == PJ_DNS_RCODE_REFUSED ||
 	        rcode == PJ_DNS_RCODE_NOTAUTH) 
     {
 	is_good = PJ_FALSE;
@@ -1450,12 +1445,10 @@ static void update_res_cache(pj_dns_resolver *resolver,
     if (ttl > resolver->settings.cache_max_ttl)
 	ttl = resolver->settings.cache_max_ttl;
 
-    /* Get a cache response entry */
-    cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key,
-    					      sizeof(*key), &hval);
-
     /* If TTL is zero, clear the same entry in the hash table */
     if (ttl == 0) {
+	cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key, 
+						  sizeof(*key), &hval);
 	/* Remove the entry before releasing its pool (see ticket #1710) */
 	pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL);
 
@@ -1465,23 +1458,24 @@ static void update_res_cache(pj_dns_resolver *resolver,
 	return;
     }
 
+    /* Get a cache response entry */
+    cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key, 
+    					      sizeof(*key), &hval);
     if (cache == NULL) {
 	cache = alloc_entry(resolver);
+    } else if (cache->ref_cnt > 1) {
+	/* When cache entry is being used by callback (to app), just decrement
+	 * ref_cnt so it will be freed after the callback returns and allocate
+	 * new entry.
+	 */
+	cache->ref_cnt--;
+	cache = alloc_entry(resolver);
     } else {
 	/* Remove the entry before resetting its pool (see ticket #1710) */
 	pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL);
 
-	if (cache->ref_cnt > 1) {
-	    /* When cache entry is being used by callback (to app),
-	     * just decrement ref_cnt so it will be freed after
-	     * the callback returns and allocate new entry.
-	     */
-	    cache->ref_cnt--;
-	    cache = alloc_entry(resolver);
-	} else {
-	    /* Reset cache to avoid bloated cache pool */
-	    reset_entry(&cache);
-	}
+	/* Reset cache to avoid bloated cache pool */
+	reset_entry(&cache);
     }
 
     /* Duplicate the packet.
diff --git a/pjlib-util/src/pjlib-util/srv_resolver.c b/pjlib-util/src/pjlib-util/srv_resolver.c
index ff9c979..02672aa 100644
--- a/pjlib-util/src/pjlib-util/srv_resolver.c
+++ b/pjlib-util/src/pjlib-util/srv_resolver.c
@@ -187,12 +187,9 @@ PJ_DEF(pj_status_t) pj_dns_srv_cancel_query(pj_dns_srv_async_query *query,
 	    has_pending = PJ_TRUE;
 	}
 	if (srv->q_aaaa) {
-	    /* Check if it is a dummy query. */
-	    if (srv->q_aaaa != (pj_dns_async_query*)0x1) {
-		pj_dns_resolver_cancel_query(srv->q_aaaa, PJ_FALSE);
-		has_pending = PJ_TRUE;
-	    }
+	    pj_dns_resolver_cancel_query(srv->q_aaaa, PJ_FALSE);
 	    srv->q_aaaa = NULL;
+	    has_pending = PJ_TRUE;
 	}
     }
 
@@ -488,22 +485,12 @@ static pj_status_t resolve_hostnames(pj_dns_srv_async_query *query_job)
 	srv->common.type = PJ_DNS_TYPE_A;
 	srv->common_aaaa.type = PJ_DNS_TYPE_AAAA;
 	srv->parent = query_job;
-	srv->q_a = NULL;
-	srv->q_aaaa = NULL;
 
 	status = PJ_SUCCESS;
 
 	/* Start DNA A record query */
 	if ((query_job->option & PJ_DNS_SRV_RESOLVE_AAAA_ONLY) == 0)
 	{
-	    if ((query_job->option & PJ_DNS_SRV_RESOLVE_AAAA) != 0) {
-		/* If there will be DNS AAAA query too, let's setup
-		 * a dummy one here, otherwise app callback may be called
-		 * immediately (before DNS AAAA query is sent) when
-		 * DNS A record is available in the cache.
-		 */
-		srv->q_aaaa = (pj_dns_async_query*)0x1;
-	    }
 	    status = pj_dns_resolver_start_query(query_job->resolver,
 						 &srv->target_name,
 						 PJ_DNS_TYPE_A, 0,
diff --git a/pjlib/build/Makefile b/pjlib/build/Makefile
index 2bd2b90..1e64950 100644
--- a/pjlib/build/Makefile
+++ b/pjlib/build/Makefile
@@ -39,7 +39,7 @@ export PJLIB_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
 	string.o timer.o types.o
 export PJLIB_CFLAGS += $(_CFLAGS)
 export PJLIB_CXXFLAGS += $(_CXXFLAGS)
-export PJLIB_LDFLAGS += $(PJLIB_EXT) $(_LDFLAGS)
+export PJLIB_LDFLAGS += $(_LDFLAGS)
 
 ###############################################################################
 # Defines for building test application
diff --git a/pjlib/src/pj/sock_bsd.c b/pjlib/src/pj/sock_bsd.c
index ae10e6f..8c2b577 100644
--- a/pjlib/src/pj/sock_bsd.c
+++ b/pjlib/src/pj/sock_bsd.c
@@ -539,10 +539,6 @@ PJ_DEF(pj_status_t) pj_sock_socket(int af,
 	    pj_sock_setsockopt(*sock, pj_SOL_SOCKET(), pj_SO_NOSIGPIPE(),
 			       &val, sizeof(val));
 	}
-	if (af != PJ_AF_INET) { /* Linux Kernel 2.4.21; June 2003 */
-	    pj_sock_setsockopt(*sock, PJ_SOL_IPV6, IPV6_V6ONLY,
-			       &val, sizeof(val));
-	}
 #if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \
     PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0
 	if (type == pj_SOCK_DGRAM()) {
diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c
index df69bd6..1e276ab 100644
--- a/pjlib/src/pj/ssl_sock_ossl.c
+++ b/pjlib/src/pj/ssl_sock_ossl.c
@@ -822,10 +822,7 @@ static void close_sockets(pj_ssl_sock_t *ssock)
     pj_lock_acquire(ssock->write_mutex);
     asock = ssock->asock;
     if (asock) {
-        // Don't set ssock->asock to NULL, as it may trigger assertion in
-        // send operation. This should be safe as active socket will simply
-        // return PJ_EINVALIDOP on any operation if it is already closed.
-        //ssock->asock = NULL;
+        ssock->asock = NULL;
         ssock->sock = PJ_INVALID_SOCKET;
     }
     sock = ssock->sock;
@@ -844,9 +841,9 @@ static void close_sockets(pj_ssl_sock_t *ssock)
 /* Reset SSL socket state */
 static void reset_ssl_sock_state(pj_ssl_sock_t *ssock)
 {
-    pj_lock_acquire(ssock->write_mutex);
     ssock->ssl_state = SSL_STATE_NULL;
-    pj_lock_release(ssock->write_mutex);
+
+    destroy_ssl(ssock);
 
     close_sockets(ssock);
 
@@ -1615,21 +1612,6 @@ static pj_status_t do_handshake(pj_ssl_sock_t *ssock)
     return PJ_EPENDING;
 }
 
-static void ssl_on_destroy(void *arg)
-{
-    pj_pool_t *pool = NULL;
-    pj_ssl_sock_t *ssock = (pj_ssl_sock_t*)arg;
-
-    destroy_ssl(ssock);
-
-    pj_lock_destroy(ssock->write_mutex);
-
-    pool = ssock->pool;
-    ssock->pool = NULL;
-    if (pool)
-	pj_pool_release(pool);
-}
-
 
 /*
  *******************************************************************
@@ -1848,7 +1830,7 @@ static pj_bool_t asock_on_accept_complete (pj_activesock_t *asock,
 
     /* Create new SSL socket instance */
     status = pj_ssl_sock_create(ssock_parent->pool,
-				&ssock_parent->newsock_param, &ssock);
+    				&ssock_parent->newsock_param, &ssock);
     if (status != PJ_SUCCESS)
 	goto on_return;
 
@@ -1924,10 +1906,12 @@ static pj_bool_t asock_on_accept_complete (pj_activesock_t *asock,
 	if (status != PJ_SUCCESS)
 	    goto on_return;
 
+	/* Temporarily add ref the group lock until active socket creation,
+	 * to make sure that group lock is destroyed if the active socket
+	 * creation fails.
+	 */
 	pj_grp_lock_add_ref(glock);
 	asock_cfg.grp_lock = ssock->param.grp_lock = glock;
-	pj_grp_lock_add_handler(ssock->param.grp_lock, ssock->pool, ssock,
-				ssl_on_destroy);
     }
 
     pj_bzero(&asock_cb, sizeof(asock_cb));
@@ -1943,6 +1927,11 @@ static pj_bool_t asock_on_accept_complete (pj_activesock_t *asock,
 				  ssock,
 				  &ssock->asock);
 
+    /* This will destroy the group lock if active socket creation fails */
+    if (asock_cfg.grp_lock) {
+	pj_grp_lock_dec_ref(asock_cfg.grp_lock);
+    }
+
     if (status != PJ_SUCCESS)
 	goto on_return;
 
@@ -2262,26 +2251,17 @@ PJ_DEF(pj_status_t) pj_ssl_sock_create (pj_pool_t *pool,
     /* Create secure socket mutex */
     status = pj_lock_create_recursive_mutex(pool, pool->obj_name,
 					    &ssock->write_mutex);
-    if (status != PJ_SUCCESS) {
-	pj_pool_release(pool);
+    if (status != PJ_SUCCESS)
 	return status;
-    }
 
     /* Init secure socket param */
     pj_ssl_sock_param_copy(pool, &ssock->param, param);
-
-    if (ssock->param.grp_lock) {
-	pj_grp_lock_add_ref(ssock->param.grp_lock);
-	pj_grp_lock_add_handler(ssock->param.grp_lock, pool, ssock,
-				ssl_on_destroy);
-    }
-
     ssock->param.read_buffer_size = ((ssock->param.read_buffer_size+7)>>3)<<3;
     if (!ssock->param.timer_heap) {
 	PJ_LOG(3,(ssock->pool->obj_name, "Warning: timer heap is not "
 		  "available. It is recommended to supply one to avoid "
-	          "a race condition if more than one worker threads "
-	          "are used."));
+		  "a race condition if more than one worker threads "
+		  "are used."));
     }
 
     /* Finally */
@@ -2297,6 +2277,8 @@ PJ_DEF(pj_status_t) pj_ssl_sock_create (pj_pool_t *pool,
  */
 PJ_DEF(pj_status_t) pj_ssl_sock_close(pj_ssl_sock_t *ssock)
 {
+    pj_pool_t *pool;
+
     PJ_ASSERT_RETURN(ssock, PJ_EINVAL);
 
     if (!ssock->pool)
@@ -2308,11 +2290,12 @@ PJ_DEF(pj_status_t) pj_ssl_sock_close(pj_ssl_sock_t *ssock)
     }
 
     reset_ssl_sock_state(ssock);
-    if (ssock->param.grp_lock) {
-	pj_grp_lock_dec_ref(ssock->param.grp_lock);
-    } else {
-	ssl_on_destroy(ssock);
-    }
+    pj_lock_destroy(ssock->write_mutex);
+    
+    pool = ssock->pool;
+    ssock->pool = NULL;
+    if (pool)
+	pj_pool_release(pool);
 
     return PJ_SUCCESS;
 }
@@ -2799,7 +2782,6 @@ pj_ssl_sock_start_accept2(pj_ssl_sock_t *ssock,
 
     /* Start accepting */
     pj_ssl_sock_param_copy(pool, &ssock->newsock_param, newsock_param);
-    ssock->newsock_param.grp_lock = NULL;
     status = pj_activesock_start_accept(ssock->asock, pool);
     if (status != PJ_SUCCESS)
 	goto on_error;
diff --git a/pjmedia/build/Makefile b/pjmedia/build/Makefile
index 4d24cf9..53faa2d 100644
--- a/pjmedia/build/Makefile
+++ b/pjmedia/build/Makefile
@@ -82,8 +82,6 @@ export PJMEDIA_CXXFLAGS += $(_CXXFLAGS)
 export PJMEDIA_LDFLAGS += $(PJLIB_LDLIB) \
 			  $(PJLIB_UTIL_LDLIB) \
 			  $(PJNATH_LDLIB) \
-			  $(PJMEDIA_EXT) \
-			  $(PJMEDIA_VIDEODEV_EXT) \
 			  $(_LDFLAGS)
 
 
@@ -99,7 +97,6 @@ export PJMEDIA_AUDIODEV_CFLAGS += $(_CFLAGS)
 export PJMEDIA_AUDIODEV_CXXFLAGS += $(_CXXFLAGS)
 export PJMEDIA_AUDIODEV_LDFLAGS += $(PJMEDIA_LDLIB) \
 				   $(PJLIB_LDLIB) \
-				   $(PJMEDIA_AUDIODEV_EXT) \
 				   $(_LDFLAGS)
 
 
@@ -149,7 +146,6 @@ export PJMEDIA_CODEC_CXXFLAGS += $(_CXXFLAGS) $(GSM_CFLAGS) $(SPEEX_CFLAGS) \
 			$(ILBC_CFLAGS) $(IPP_CFLAGS) $(G7221_CFLAGS)
 export PJMEDIA_CODEC_LDFLAGS += $(PJMEDIA_LDLIB) \
 				$(PJLIB_LDLIB) \
-				$(PJMEDIA_CODEC_EXT) \
 				$(_LDFLAGS)
 
 ###############################################################################
diff --git a/pjnath/build/Makefile b/pjnath/build/Makefile
index 8fb976d..1bc08b5 100644
--- a/pjnath/build/Makefile
+++ b/pjnath/build/Makefile
@@ -30,7 +30,7 @@ export _CFLAGS 	:= $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
 		   $(CC_INC)../../pjlib-util/include
 export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
 		   $(HOST_CXXFLAGS) $(CXXFLAGS)
-export _LDFLAGS := $(CC_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
+export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
 		   $(APP_LDFLAGS) $(LDFLAGS) 
 
 ###############################################################################
@@ -43,8 +43,7 @@ export PJNATH_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
 		stun_transaction.o turn_session.o turn_sock.o
 export PJNATH_CFLAGS += $(_CFLAGS)
 export PJNATH_CXXFLAGS += $(_CXXFLAGS)
-export PJNATH_LDFLAGS += $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(PJNATH_EXT) \
-			$(_LDFLAGS)
+export PJNATH_LDFLAGS += $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS)
 
 ###############################################################################
 # Defines for building test application
diff --git a/pjsip/build/Makefile b/pjsip/build/Makefile
index eef4176..a9bd5ad 100644
--- a/pjsip/build/Makefile
+++ b/pjsip/build/Makefile
@@ -34,7 +34,7 @@ export PJSIP_SIMPLE_SHLIB := $(PJSIP_SIMPLE_SONAME).$(PJ_VERSION_MAJOR)
 export PJSUA_LIB_SONAME := libpjsua.$(SHLIB_SUFFIX)
 export PJSUA_LIB_SHLIB := $(PJSUA_LIB_SONAME).$(PJ_VERSION_MAJOR)
 export PJSUA2_LIB_SONAME := libpjsua2.$(SHLIB_SUFFIX)
-export PJSUA2_LIB_SHLIB := $(PJSUA2_LIB_SONAME).$(PJ_VERSION_MAJOR)v5
+export PJSUA2_LIB_SHLIB := $(PJSUA2_LIB_SONAME).$(PJ_VERSION_MAJOR)
 endif
 
 ###############################################################################
diff --git a/pjsip/include/pjsip-simple/evsub.h b/pjsip/include/pjsip-simple/evsub.h
index 405a0cd..8c8fb85 100644
--- a/pjsip/include/pjsip-simple/evsub.h
+++ b/pjsip/include/pjsip-simple/evsub.h
@@ -246,8 +246,7 @@ PJ_DECL(pjsip_module*) pjsip_evsub_instance(void);
  *			registered.
  * @param event_name	Event package identification.
  * @param expires	Default subscription expiration time, in seconds.
- * @param accept_cnt	Number of strings in Accept array. The value must
- *			not be greater than PJSIP_GENERIC_ARRAY_MAX_COUNT.
+ * @param accept_cnt	Number of strings in Accept array.
  * @param accept	Array of Accept value.
  *
  * @return		PJ_SUCCESS on success.
diff --git a/pjsip/include/pjsip-ua/sip_inv.h b/pjsip/include/pjsip-ua/sip_inv.h
index 8915fe0..c4fa97f 100644
--- a/pjsip/include/pjsip-ua/sip_inv.h
+++ b/pjsip/include/pjsip-ua/sip_inv.h
@@ -383,11 +383,6 @@ struct pjsip_timer;
  * Other applications that want to use these pools must understand
  * that the flip-flop pool's lifetimes are synchronized to the
  * SDP offer-answer negotiation.
- *
- * The lifetime of this session is controlled by the reference counter in this
- * structure, which is manipulated by calling #pjsip_inv_add_ref and
- * #pjsip_inv_dec_ref. When the reference counter has reached zero, then
- * this session will be destroyed.
  */
 struct pjsip_inv_session
 {
@@ -417,7 +412,6 @@ struct pjsip_inv_session
     struct pjsip_timer	*timer;			    /**< Session Timers.    */
     pj_bool_t		 following_fork;	    /**< Internal, following
 							 forked media?	    */
-    pj_atomic_t		*ref_cnt;		    /**< Reference counter. */
 };
 
 
@@ -637,30 +631,6 @@ PJ_DECL(pj_status_t) pjsip_inv_create_uas(pjsip_dialog *dlg,
 
 
 /**
- * Add reference counter to the INVITE session. The reference counter controls
- * the life time of the session, ie. when the counter reaches zero, then it 
- * will be destroyed.
- *
- * @param inv       The INVITE session.
- * @return          PJ_SUCCESS if the INVITE session reference counter
- *                  was increased.
- */
-PJ_DECL(pj_status_t) pjsip_inv_add_ref( pjsip_inv_session *inv );
-
-/**
- * Decrement reference counter of the INVITE session.
- * When the session is no longer used, it will be destroyed and
- * caller is informed with PJ_EGONE return status.
- *
- * @param inv       The INVITE session.
- * @return          PJ_SUCCESS if the INVITE session reference counter
- *                  was decreased. A status PJ_EGONE will be returned to 
- *                  inform that session is destroyed.
- */
-PJ_DECL(pj_status_t) pjsip_inv_dec_ref( pjsip_inv_session *inv );
-
-
-/**
  * Forcefully terminate and destroy INVITE session, regardless of
  * the state of the session. Note that this function should only be used
  * when there is failure in the INVITE session creation. After the
diff --git a/pjsip/include/pjsip/sip_endpoint.h b/pjsip/include/pjsip/sip_endpoint.h
index fbc9a6e..2c02965 100644
--- a/pjsip/include/pjsip/sip_endpoint.h
+++ b/pjsip/include/pjsip/sip_endpoint.h
@@ -583,8 +583,7 @@ PJ_DECL(pj_bool_t) pjsip_endpt_has_capability( pjsip_endpoint *endpt,
  * @param hname	    If htype specifies PJSIP_H_OTHER, then the header name
  *		    must be supplied in this argument. Otherwise the value
  *		    must be set to NULL.
- * @param count	    The number of tags in the array. The value must not
- *		    be greater than PJSIP_GENERIC_ARRAY_MAX_COUNT.
+ * @param count	    The number of tags in the array.
  * @param tags	    Array of tags describing the capabilities or extensions
  *		    to be added to the appropriate header.
  *
diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c
index c5821dc..8d0f516 100644
--- a/pjsip/src/pjsip-simple/evsub.c
+++ b/pjsip/src/pjsip-simple/evsub.c
@@ -412,9 +412,7 @@ PJ_DEF(pj_status_t) pjsip_evsub_register_pkg( pjsip_module *pkg_mod,
     unsigned i;
 
     PJ_ASSERT_RETURN(pkg_mod && event_name, PJ_EINVAL);
-    
-    /* Make sure accept_cnt < PJ_ARRAY_SIZE(pkg->pkg_accept->values) */
-    PJ_ASSERT_RETURN(accept_cnt <= PJSIP_GENERIC_ARRAY_MAX_COUNT, 
+    PJ_ASSERT_RETURN(accept_cnt < PJ_ARRAY_SIZE(pkg->pkg_accept->values), 
 		     PJ_ETOOMANY);
 
     /* Make sure evsub module has been initialized */
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index 4bb6f33..2ab0715 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -195,65 +195,6 @@ static pj_status_t mod_inv_unload(void)
 }
 
 /*
- * Add reference to INVITE session.
- */
-PJ_DEF(pj_status_t) pjsip_inv_add_ref( pjsip_inv_session *inv )
-{
-    PJ_ASSERT_RETURN(inv && inv->ref_cnt, PJ_EINVAL);
-
-    pj_atomic_inc(inv->ref_cnt);
-
-    return PJ_SUCCESS;
-}
-
-static void inv_session_destroy(pjsip_inv_session *inv)
-{
-    if (inv->last_ack) {
-	pjsip_tx_data_dec_ref(inv->last_ack);
-	inv->last_ack = NULL;
-    }
-    if (inv->invite_req) {
-	pjsip_tx_data_dec_ref(inv->invite_req);
-	inv->invite_req = NULL;
-    }
-    if (inv->pending_bye) {
-	pjsip_tx_data_dec_ref(inv->pending_bye);
-	inv->pending_bye = NULL;
-    }
-    pjsip_100rel_end_session(inv);
-    pjsip_timer_end_session(inv);
-    pjsip_dlg_dec_session(inv->dlg, &mod_inv.mod);
-
-    /* Release the flip-flop pools */
-    pj_pool_release(inv->pool_prov);
-    inv->pool_prov = NULL;
-    pj_pool_release(inv->pool_active);
-    inv->pool_active = NULL;
-
-    pj_atomic_destroy(inv->ref_cnt);
-    inv->ref_cnt = NULL;
-}
-
-/*
- * Decrease INVITE session reference, destroy it when the reference count
- * reaches zero.
- */
-PJ_DEF(pj_status_t) pjsip_inv_dec_ref( pjsip_inv_session *inv )
-{
-    pj_atomic_value_t ref_cnt;
-
-    PJ_ASSERT_RETURN(inv && inv->ref_cnt, PJ_EINVAL);
-
-    ref_cnt = pj_atomic_dec_and_get(inv->ref_cnt);
-    pj_assert( ref_cnt >= 0);
-    if (ref_cnt == 0) {
-        inv_session_destroy(inv);
-        return PJ_EGONE;
-    } 
-    return PJ_SUCCESS;    
-}
-
-/*
  * Set session state.
  */
 static void inv_set_state(pjsip_inv_session *inv, pjsip_inv_state state,
@@ -319,7 +260,27 @@ static void inv_set_state(pjsip_inv_session *inv, pjsip_inv_state state,
     if (inv->state == PJSIP_INV_STATE_DISCONNECTED &&
 	prev_state != PJSIP_INV_STATE_DISCONNECTED) 
     {
-	pjsip_inv_dec_ref(inv);
+	if (inv->last_ack) {
+	    pjsip_tx_data_dec_ref(inv->last_ack);
+	    inv->last_ack = NULL;
+	}
+	if (inv->invite_req) {
+	    pjsip_tx_data_dec_ref(inv->invite_req);
+	    inv->invite_req = NULL;
+	}
+	if (inv->pending_bye) {
+	    pjsip_tx_data_dec_ref(inv->pending_bye);
+	    inv->pending_bye = NULL;
+	}
+	pjsip_100rel_end_session(inv);
+	pjsip_timer_end_session(inv);
+	pjsip_dlg_dec_session(inv->dlg, &mod_inv.mod);
+
+	/* Release the flip-flop pools */
+	pj_pool_release(inv->pool_prov);
+	inv->pool_prov = NULL;
+	pj_pool_release(inv->pool_active);
+	inv->pool_active = NULL;
     }
 }
 
@@ -876,12 +837,6 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uac( pjsip_dialog *dlg,
     inv = PJ_POOL_ZALLOC_T(dlg->pool, pjsip_inv_session);
     pj_assert(inv != NULL);
 
-    status = pj_atomic_create(dlg->pool, 0, &inv->ref_cnt);
-    if (status != PJ_SUCCESS) {
-	pjsip_dlg_dec_lock(dlg);
-	return status;
-    }
-
     inv->pool = dlg->pool;
     inv->role = PJSIP_ROLE_UAC;
     inv->state = PJSIP_INV_STATE_NULL;
@@ -925,7 +880,6 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uac( pjsip_dialog *dlg,
     pjsip_100rel_attach(inv);
 
     /* Done */
-    pjsip_inv_add_ref(inv);
     *p_inv = inv;
 
     pjsip_dlg_dec_lock(dlg);
@@ -1516,12 +1470,6 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uas( pjsip_dialog *dlg,
     inv = PJ_POOL_ZALLOC_T(dlg->pool, pjsip_inv_session);
     pj_assert(inv != NULL);
 
-    status = pj_atomic_create(dlg->pool, 0, &inv->ref_cnt);
-    if (status != PJ_SUCCESS) {
-	pjsip_dlg_dec_lock(dlg);
-	return status;
-    }
-
     inv->pool = dlg->pool;
     inv->role = PJSIP_ROLE_UAS;
     inv->state = PJSIP_INV_STATE_NULL;
@@ -1591,7 +1539,6 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uas( pjsip_dialog *dlg,
     }
 
     /* Done */
-    pjsip_inv_add_ref(inv);
     pjsip_dlg_dec_lock(dlg);
     *p_inv = inv;
 
diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c
index ad736fb..800e9f3 100644
--- a/pjsip/src/pjsip/sip_dialog.c
+++ b/pjsip/src/pjsip/sip_dialog.c
@@ -92,12 +92,6 @@ static pj_status_t create_dialog( pjsip_user_agent *ua,
     pj_list_init(&dlg->inv_hdr);
     pj_list_init(&dlg->rem_cap_hdr);
 
-    /* Init client authentication session. */
-    status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt,
-				 dlg->pool, 0);
-    if (status != PJ_SUCCESS)
-	goto on_error;
-
     status = pj_mutex_create_recursive(pool, dlg->obj_name, &dlg->mutex_);
     if (status != PJ_SUCCESS)
 	goto on_error;
@@ -289,6 +283,12 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua,
     /* Initial route set is empty. */
     pj_list_init(&dlg->route_set);
 
+    /* Init client authentication session. */
+    status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt,
+				 dlg->pool, 0);
+    if (status != PJ_SUCCESS)
+	goto on_error;
+
     /* Register this dialog to user agent. */
     status = pjsip_ua_register_dlg( ua, dlg );
     if (status != PJ_SUCCESS)
@@ -506,6 +506,12 @@ pj_status_t create_uas_dialog( pjsip_user_agent *ua,
     }
     dlg->route_set_frozen = PJ_TRUE;
 
+    /* Init client authentication session. */
+    status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt,
+				 dlg->pool, 0);
+    if (status != PJ_SUCCESS)
+	goto on_error;
+
     /* Increment the dialog's lock since tsx may cause the dialog to be
      * destroyed prematurely (such as in case of transport error).
      */
diff --git a/pjsip/src/pjsip/sip_endpoint.c b/pjsip/src/pjsip/sip_endpoint.c
index 7889851..b606b19 100644
--- a/pjsip/src/pjsip/sip_endpoint.c
+++ b/pjsip/src/pjsip/sip_endpoint.c
@@ -371,7 +371,6 @@ PJ_DEF(pj_status_t) pjsip_endpt_add_capability( pjsip_endpoint *endpt,
 
     /* Check arguments. */
     PJ_ASSERT_RETURN(endpt!=NULL && count>0 && tags, PJ_EINVAL);
-    PJ_ASSERT_RETURN(count <= PJSIP_GENERIC_ARRAY_MAX_COUNT, PJ_ETOOMANY);
     PJ_ASSERT_RETURN(htype==PJSIP_H_ACCEPT || 
 		     htype==PJSIP_H_ALLOW ||
 		     htype==PJSIP_H_SUPPORTED,
diff --git a/pjsip/src/pjsip/sip_resolve.c b/pjsip/src/pjsip/sip_resolve.c
index 3f3654d..ed326ba 100644
--- a/pjsip/src/pjsip/sip_resolve.c
+++ b/pjsip/src/pjsip/sip_resolve.c
@@ -452,7 +452,7 @@ PJ_DEF(void) pjsip_resolve( pjsip_resolver_t *resolver,
 	}
 
 	/* Resolve DNS AAAA record if address family is not fixed to IPv4 */
-	if (af != pj_AF_INET() && status == PJ_SUCCESS) {
+	if (af != pj_AF_INET()) {
 	    status = pj_dns_resolver_start_query(resolver->res, 
 						 &query->naptr[0].name,
 						 PJ_DNS_TYPE_AAAA, 0, 
@@ -530,9 +530,9 @@ static void dns_a_callback(void *user_data,
 
 	    ++srv->count;
 	}
-    }
-    
-    if (status != PJ_SUCCESS) {
+
+    } else {
+
 	char errmsg[PJ_ERR_MSG_SIZE];
 
 	/* Log error */
@@ -593,9 +593,9 @@ static void dns_aaaa_callback(void *user_data,
 
 	    ++srv->count;
 	}
-    }
-    
-    if (status != PJ_SUCCESS) {
+
+    } else {
+
 	char errmsg[PJ_ERR_MSG_SIZE];
 
 	/* Log error */
diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
index f87e47c..49d8202 100644
--- a/pjsip/src/pjsip/sip_transport.c
+++ b/pjsip/src/pjsip/sip_transport.c
@@ -491,13 +491,8 @@ static void tx_data_destroy(pjsip_tx_data *tdata)
  */
 PJ_DEF(pj_status_t) pjsip_tx_data_dec_ref( pjsip_tx_data *tdata )
 {
-    pj_atomic_value_t ref_cnt;
-    
-    PJ_ASSERT_RETURN(tdata && tdata->ref_cnt, PJ_EINVAL);
-
-    ref_cnt = pj_atomic_dec_and_get(tdata->ref_cnt);
-    pj_assert( ref_cnt >= 0);
-    if (ref_cnt == 0) {
+    pj_assert( pj_atomic_get(tdata->ref_cnt) > 0);
+    if (pj_atomic_dec_and_get(tdata->ref_cnt) <= 0) {
 	tx_data_destroy(tdata);
 	return PJSIP_EBUFDESTROYED;
     } else {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/pjproject.git



More information about the Pkg-voip-commits mailing list