From bf8c33f65fccc74a14940fa341f55b38e141ab4a Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Mon, 5 Dec 2011 02:12:38 +0000 Subject: Fixed #1418 (Library restart fails with PJLIB_UTIL_ESTUNNOTRESPOND error after several times) due to bug in calling pj_sock_select(). Thanks RĂ©gis Montoya for the report and testing the fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3896 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib-util/src/pjlib-util/stun_simple_client.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'pjlib-util') diff --git a/pjlib-util/src/pjlib-util/stun_simple_client.c b/pjlib-util/src/pjlib-util/stun_simple_client.c index af597fc5..dd798bd6 100644 --- a/pjlib-util/src/pjlib-util/stun_simple_client.c +++ b/pjlib-util/src/pjlib-util/stun_simple_client.c @@ -19,6 +19,7 @@ */ #include #include +#include #include #include #include @@ -44,7 +45,7 @@ PJ_DEF(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf, { unsigned srv_cnt; pj_sockaddr_in srv_addr[2]; - int i, j, send_cnt = 0; + int i, j, send_cnt = 0, nfds; pj_pool_t *pool; struct query_rec { struct { @@ -113,6 +114,17 @@ PJ_DEF(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf, TRACE_((THIS_FILE, " Done initialization.")); +#if defined(PJ_SELECT_NEEDS_NFDS) && PJ_SELECT_NEEDS_NFDS!=0 + nfds = -1; + for (i=0; i nfds) { + nfds = sock[i]; + } + } +#else + nfds = FD_SETSIZE-1; +#endif + /* Main retransmission loop. */ for (send_cnt=0; send_cnt