Changeset 3408 for pjproject


Ignore:
Timestamp:
Jan 21, 2011 7:15:22 AM (14 years ago)
Author:
bennylp
Message:

Fixed #1197: WSAECONNRESET errors on Windows 2000 or 2003 may cause UDP transport to stop working

Location:
pjproject/trunk/pjlib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/config.h

    r3316 r3408  
    799799#ifndef PJ_HAS_SSL_SOCK 
    800800#  define PJ_HAS_SSL_SOCK           0 
     801#endif 
     802 
     803 
     804/** 
     805 * Disable WSAECONNRESET error for UDP sockets on Win32 platforms. See 
     806 * https://trac.pjsip.org/repos/ticket/1197. 
     807 * 
     808 * Default: 1 
     809 */ 
     810#ifndef PJ_SOCK_DISABLE_WSAECONNRESET 
     811#   define PJ_SOCK_DISABLE_WSAECONNRESET    1 
    801812#endif 
    802813 
  • pjproject/trunk/pjlib/src/pj/sock_bsd.c

    r3299 r3408  
    494494    if (*sock == PJ_INVALID_SOCKET)  
    495495        return PJ_RETURN_OS_ERROR(pj_get_native_netos_error()); 
    496     else 
    497         return PJ_SUCCESS; 
     496     
     497#if PJ_SOCK_DISABLE_WSAECONNRESET && \ 
     498    (!defined(PJ_WIN32_WINCE) || PJ_WIN32_WINCE==0) 
     499 
     500#ifndef SIO_UDP_CONNRESET 
     501    #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) 
     502#endif 
     503 
     504    /* Disable WSAECONNRESET for UDP. 
     505     * See https://trac.pjsip.org/repos/ticket/1197 
     506     */ 
     507    if (type==PJ_SOCK_DGRAM) { 
     508        DWORD dwBytesReturned = 0; 
     509        BOOL bNewBehavior = FALSE; 
     510        DWORD rc; 
     511 
     512        rc = WSAIoctl(*sock, SIO_UDP_CONNRESET, 
     513                      &bNewBehavior, sizeof(bNewBehavior), 
     514                      NULL, 0, &dwBytesReturned, 
     515                      NULL, NULL); 
     516 
     517        if (rc==SOCKET_ERROR) { 
     518            // Ignored.. 
     519        } 
     520    } 
     521#endif 
     522 
     523    return PJ_SUCCESS; 
    498524} 
    499525 
Note: See TracChangeset for help on using the changeset viewer.