[Freeswitch-svn] [commit] r8006 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Wed Apr 2 16:53:13 EDT 2008


Author: anthm
Date: Wed Apr  2 16:53:13 2008
New Revision: 8006

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/switch_rtp.c

Log:
update

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Wed Apr  2 16:53:13 2008
@@ -398,7 +398,8 @@
 	SWITCH_RTP_FLAG_AUTO_CNG = (1 << 15),
 	SWITCH_RTP_FLAG_SECURE_SEND_RESET = (1 << 16),
 	SWITCH_RTP_FLAG_SECURE_RECV_RESET = (1 << 17),
-	SWITCH_RTP_FLAG_PROXY_MEDIA = (1 << 18)
+	SWITCH_RTP_FLAG_PROXY_MEDIA = (1 << 18),
+	SWITCH_RTP_FLAG_SHUTDOWN = (1 << 19)
 } switch_rtp_flag_t;
 
 

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Wed Apr  2 16:53:13 2008
@@ -862,13 +862,12 @@
 {
 	uint8_t ret;
 
-	if (!rtp_session || !rtp_session->flag_mutex) {
+	if (!rtp_session || !rtp_session->flag_mutex || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SHUTDOWN)) {
 		return 0;
 	}
 
 	switch_mutex_lock(rtp_session->flag_mutex);
-	ret = (rtp_session != NULL && 
-		   switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) && rtp_session->sock && rtp_session->remote_addr && rtp_session->ready == 2) ? 1 : 0;
+	ret = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) && rtp_session->sock && rtp_session->remote_addr && rtp_session->ready == 2) ? 1 : 0;
 	switch_mutex_unlock(rtp_session->flag_mutex);
 
 	return ret;
@@ -883,7 +882,7 @@
 		return;
 	}
 
-	switch_mutex_lock((*rtp_session)->flag_mutex);
+	switch_set_flag_locked((*rtp_session), SWITCH_RTP_FLAG_SHUTDOWN);
 
 	READ_INC((*rtp_session));
 	WRITE_INC((*rtp_session));
@@ -893,6 +892,7 @@
 	READ_DEC((*rtp_session));
 	WRITE_DEC((*rtp_session));
 	
+	switch_mutex_lock((*rtp_session)->flag_mutex);
 
 	switch_rtp_kill_socket(*rtp_session);
 



More information about the Freeswitch-svn mailing list