Changeset 2155 for pjproject


Ignore:
Timestamp:
Jul 18, 2008 10:33:09 AM (16 years ago)
Author:
bennylp
Message:

Ticket #575: Unregistering from Windows IOCompletionPort (IOCP) ioqueue does not close the socket handle (thanks Gang Liu for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ioqueue_winnt.c

    r2039 r2155  
    787787     * will come to the handle. 
    788788     */ 
    789     CloseHandle(key->hnd); 
     789    /* Update 2008/07/18 (http://trac.pjsip.org/repos/ticket/575): 
     790     *  - It seems that CloseHandle() in itself does not actually close 
     791     *    the socket (i.e. it will still appear in "netstat" output). Also 
     792     *    if we only use CloseHandle(), an "Invalid Handle" exception will 
     793     *    be raised in WSACleanup(). 
     794     *  - MSDN documentation says that CloseHandle() must be called after  
     795     *    closesocket() call (see 
     796     *    http://msdn.microsoft.com/en-us/library/ms724211(VS.85).aspx). 
     797     *    But turns out that this will raise "Invalid Handle" exception 
     798     *    in debug mode. 
     799     *  So because of this, we replaced CloseHandle() with closesocket() 
     800     *  instead. These was tested on WinXP SP2. 
     801     */ 
     802    //CloseHandle(key->hnd); 
     803    pj_sock_close((pj_sock_t)key->hnd); 
    790804 
    791805    /* Reset callbacks */ 
Note: See TracChangeset for help on using the changeset viewer.