[Freeswitch-svn] [commit] r2694 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Wed Sep 13 21:37:56 EDT 2006


Author: mikej
Date: Wed Sep 13 21:37:55 2006
New Revision: 2694

Modified:
   freeswitch/trunk/src/switch_rtp.c

Log:
tweak socket shutdown to eliminate race

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Wed Sep 13 21:37:55 2006
@@ -553,8 +553,11 @@
 {
 	assert(rtp_session != NULL);
 	switch_mutex_lock(rtp_session->flag_mutex);
-	apr_socket_shutdown(rtp_session->sock, APR_SHUTDOWN_READWRITE);
-	switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO);
+	if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
+		assert(rtp_session->sock != NULL);
+		apr_socket_shutdown(rtp_session->sock, APR_SHUTDOWN_READWRITE);
+		switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO);
+	}
 	switch_mutex_unlock(rtp_session->flag_mutex);
 }
 



More information about the Freeswitch-svn mailing list