Ignore:
Timestamp:
Dec 5, 2011 2:12:38 AM (12 years ago)
Author:
bennylp
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjlib-util/src/pjlib-util/stun_simple_client.c

    r3553 r3896  
    2020#include <pjlib-util/stun_simple.h> 
    2121#include <pjlib-util/errno.h> 
     22#include <pj/compat/socket.h> 
    2223#include <pj/log.h> 
    2324#include <pj/os.h> 
     
    4546    unsigned srv_cnt; 
    4647    pj_sockaddr_in srv_addr[2]; 
    47     int i, j, send_cnt = 0; 
     48    int i, j, send_cnt = 0, nfds; 
    4849    pj_pool_t *pool; 
    4950    struct query_rec { 
     
    114115    TRACE_((THIS_FILE, "  Done initialization.")); 
    115116 
     117#if defined(PJ_SELECT_NEEDS_NFDS) && PJ_SELECT_NEEDS_NFDS!=0 
     118    nfds = -1; 
     119    for (i=0; i<sock_cnt; ++i) { 
     120        if (sock[i] > nfds) { 
     121            nfds = sock[i]; 
     122        } 
     123    } 
     124#else 
     125    nfds = FD_SETSIZE-1; 
     126#endif 
     127 
    116128    /* Main retransmission loop. */ 
    117129    for (send_cnt=0; send_cnt<MAX_REQUEST; ++send_cnt) { 
     
    170182            } 
    171183 
    172             select_rc = pj_sock_select(PJ_IOQUEUE_MAX_HANDLES, &r, NULL, NULL, &timeout); 
     184            select_rc = pj_sock_select(nfds+1, &r, NULL, NULL, &timeout); 
    173185            TRACE_((THIS_FILE, "  select() rc=%d", select_rc)); 
    174186            if (select_rc < 1) 
Note: See TracChangeset for help on using the changeset viewer.