Changeset 4304


Ignore:
Timestamp:
Dec 5, 2012 9:48:44 AM (8 years ago)
Author:
bennylp
Message:

Fixed #1597: Handle socket failure in STUN resolution when coming back from iPhone/iOS background mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r4279 r4304  
    351351            status=pjstun_get_mapped_addr2(&pjsua_var.cp.factory, &stun_opt, 
    352352                                           2, sock, resolved_addr); 
     353#if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \ 
     354            PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0 
     355            /* Handle EPIPE (Broken Pipe) error, which happens on UDP socket 
     356             * after app wakes up from suspended state. In this case, simply 
     357             * just retry. 
     358             * P.S.: The magic status is PJ_STATUS_FROM_OS(EPIPE) 
     359             */ 
     360            if (status == 120032) { 
     361                PJ_LOG(4,(THIS_FILE, "Got EPIPE error, retrying..")); 
     362                pj_sock_close(sock[0]); 
     363                sock[0] = PJ_INVALID_SOCKET; 
     364 
     365                pj_sock_close(sock[1]); 
     366                sock[1] = PJ_INVALID_SOCKET; 
     367 
     368                continue; 
     369            } 
     370            else 
     371#endif 
    353372            if (status != PJ_SUCCESS) { 
    354373                pjsua_perror(THIS_FILE, "STUN resolve error", status); 
Note: See TracChangeset for help on using the changeset viewer.