diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-06-22 22:29:12 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-06-22 22:29:12 +0000 |
commit | 7b85925507853606e5b2a47fd47bd7c24f8a26ac (patch) | |
tree | 2bf227cc8dea10d91fd252388aef73b576633fe8 /pjsip/src/pjsip/sip_transport_udp.c | |
parent | fcf2b8c53d0ea0607cb9f12bf2ff52cb38f3febc (diff) |
Fixed bug in sip_transport_udp: socket is closed after unregistered from ioqueue
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@543 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsip/sip_transport_udp.c')
-rw-r--r-- | pjsip/src/pjsip/sip_transport_udp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pjsip/src/pjsip/sip_transport_udp.c b/pjsip/src/pjsip/sip_transport_udp.c index 72acba11..6312756c 100644 --- a/pjsip/src/pjsip/sip_transport_udp.c +++ b/pjsip/src/pjsip/sip_transport_udp.c @@ -336,12 +336,16 @@ static pj_status_t udp_destroy( pjsip_transport *transport ) */ /* Unregister from ioqueue. */ - if (tp->key) + if (tp->key) { pj_ioqueue_unregister(tp->key); - - /* Close socket. */ - if (tp->sock && tp->sock != PJ_INVALID_SOCKET) - pj_sock_close(tp->sock); + tp->key = NULL; + } else { + /* Close socket. */ + if (tp->sock && tp->sock != PJ_INVALID_SOCKET) { + pj_sock_close(tp->sock); + tp->sock = PJ_INVALID_SOCKET; + } + } /* Must poll ioqueue because IOCP calls the callback when socket * is closed. We poll the ioqueue until all pending callbacks |