]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 29 May 2007 20:57:17 +0000 (20:57 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 29 May 2007 20:57:17 +0000 (20:57 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5233 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
src/switch_core_session.c

index 34a0f49577099141f3ae128888e2723df8d24c64..657507aaad4131968632670cb635c8ff0577f1b7 100644 (file)
@@ -1568,7 +1568,6 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
                        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");
        }
index 66e92fe69916b57fcc56ec7a197b9348d2aa4396..7dec0c428053762901e19efbf10a3f0f0a071750 100644 (file)
@@ -681,6 +681,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t *
        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_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_se
        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;
 }