From e9a7dab950797403bb5ba42a23d2845c50bdb8c6 Mon Sep 17 00:00:00 2001 From: Mamadou DIOP Date: Thu, 20 Aug 2015 18:01:33 +0200 Subject: Fix issue reported at https://groups.google.com/forum/#!topic/doubango/oeg-OBEH0G4 --- tinySIP/src/transports/tsip_transport.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tinySIP/src') diff --git a/tinySIP/src/transports/tsip_transport.c b/tinySIP/src/transports/tsip_transport.c index ac1c8d1..f86f718 100644 --- a/tinySIP/src/transports/tsip_transport.c +++ b/tinySIP/src/transports/tsip_transport.c @@ -647,8 +647,13 @@ int tsip_transport_add_stream_peer_2(tsip_transport_t *self, tnet_fd_t local_fd, tsip_transport_stream_peers_lock(self); if(tsip_transport_have_stream_peer_with_local_fd(self, local_fd)){ - // could happen if the closed socket haven't raise "close event" yet and new own added : Windows only + TSK_DEBUG_INFO("Peer with local fd=%d already exist", local_fd); +#if TSIP_UNDER_WINDOWS + // could happen if the closed socket haven't raised "close event" yet and new one added : Windows only tsip_transport_remove_stream_peer_by_local_fd(self, local_fd); +#else + peer = tsip_transport_pop_stream_peer_by_local_fd(self, local_fd); +#endif } if(tsk_strnullORempty(remote_host) || !remote_port){ @@ -665,7 +670,7 @@ int tsip_transport_add_stream_peer_2(tsip_transport_t *self, tnet_fd_t local_fd, goto bail; } - if(!(peer = tsk_object_new(tsip_transport_stream_peer_def_t))){ + if(!peer && !(peer = tsk_object_new(tsip_transport_stream_peer_def_t))){ TSK_DEBUG_ERROR("Failed to create network stream peer"); ret = -4; goto bail; -- cgit v1.1