[Freeswitch-svn] [commit] r5233 - in freeswitch/trunk/src: . mod/endpoints/mod_wanpipe

Freeswitch SVN anthm at freeswitch.org
Tue May 29 16:57:17 EDT 2007


Author: anthm
Date: Tue May 29 16:57:17 2007
New Revision: 5233

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
   freeswitch/trunk/src/switch_core_session.c

Log:
update

Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Tue May 29 16:57:17 2007
@@ -1568,7 +1568,6 @@
 			ret = 0;
 			goto done;
 		}
-		switch_core_session_thread_launch(session);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create new Inbound Channel!\n");
 	}

Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c	(original)
+++ freeswitch/trunk/src/switch_core_session.c	Tue May 29 16:57:17 2007
@@ -681,6 +681,7 @@
 	switch_core_media_bug_remove_all(*session);
 	switch_buffer_destroy(&(*session)->raw_read_buffer);
 	switch_buffer_destroy(&(*session)->raw_write_buffer);
+
 	switch_channel_uninit((*session)->channel);
 
 	pool = (*session)->pool;
@@ -721,19 +722,26 @@
 	switch_threadattr_t *thd_attr;;
 	switch_threadattr_create(&thd_attr, session->pool);
 	switch_threadattr_detach_set(thd_attr, 1);
+	switch_status_t status = SWITCH_STATUS_FALSE;
 
+	switch_mutex_lock(session->mutex);
+	
 	if (!session->thread_running) {
+		session->thread_running = 1;
 		switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 		if (switch_thread_create(&thread, thd_attr, switch_core_session_thread, session, session->pool) == SWITCH_STATUS_SUCCESS) {
-			return SWITCH_STATUS_SUCCESS;
+			status = SWITCH_STATUS_SUCCESS;
 		} else {
+			session->thread_running = 0;
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot create thread!\n");
 		}
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot double-launch thread!\n");
 	}
 
-	return SWITCH_STATUS_FALSE;
+	switch_mutex_unlock(session->mutex);
+
+	return status;
 }
 
 



More information about the Freeswitch-svn mailing list