Changeset 5388


Ignore:
Timestamp:
Jul 18, 2016 11:02:02 AM (8 years ago)
Author:
nanang
Message:

Misc (re #1928): Fixed possible stuck issue in pjnath-test caused by blocking recvfrom() upon concurrent socket events.

Location:
pjproject/trunk/pjnath/src/pjnath-test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath-test/concur_test.c

    r5339 r5388  
    264264    pj_assert(status == PJ_SUCCESS); 
    265265 
     266    /* Set socket to nonblocking to avoid stuck in recv/recvfrom() on concurrent events */ 
     267    app_set_sock_nb(test_sess.server_sock); 
     268 
    266269    addr_len = sizeof(bind_addr); 
    267270    status = pj_sock_getsockname(test_sess.server_sock, &bind_addr, &addr_len); 
  • pjproject/trunk/pjnath/src/pjnath-test/test.c

    r4728 r5388  
    2020#include "test.h" 
    2121#include <pjlib.h> 
     22#include <pj/compat/socket.h> 
    2223 
    2324void app_perror(const char *msg, pj_status_t rc) 
     
    2930    pj_strerror(rc, errbuf, sizeof(errbuf)); 
    3031    PJ_LOG(1,("test", "%s: [pj_status_t=%d] %s", msg, rc, errbuf)); 
     32} 
     33 
     34/* Set socket to nonblocking. */ 
     35void app_set_sock_nb(pj_sock_t sock) 
     36{ 
     37#if defined(PJ_WIN32) && PJ_WIN32!=0 || \ 
     38    defined(PJ_WIN64) && PJ_WIN64 != 0 || \ 
     39    defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 
     40    u_long value = 1; 
     41    ioctlsocket(sock, FIONBIO, &value); 
     42#else 
     43    pj_uint32_t value = 1; 
     44    ioctl(sock, FIONBIO, &value); 
     45#endif 
    3146} 
    3247 
  • pjproject/trunk/pjnath/src/pjnath-test/test.h

    r5350 r5388  
    4545 
    4646extern void app_perror(const char *title, pj_status_t rc); 
     47extern void app_set_sock_nb(pj_sock_t sock); 
    4748extern pj_pool_factory *mem; 
    4849 
Note: See TracChangeset for help on using the changeset viewer.