add some robustness to deal with runaway threads

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5140 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-05-11 00:27:55 +00:00
parent 6b1f10b9e9
commit 1cb336eaf0
10 changed files with 94 additions and 19 deletions
+9 -3
View File
@@ -1504,9 +1504,15 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
switch_channel_mark_answered(channel);
switch_channel_set_state(channel, CS_INIT);
switch_core_session_thread_launch(tech_pvt->session);
add_pvt(tech_pvt, PA_MASTER);
stream->write_function(stream, "SUCCESS:%s:%s\n", tech_pvt->call_id, switch_core_session_get_uuid(tech_pvt->session));
if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
switch_core_session_destroy(&session);
stream->write_function(stream, "FAIL:Thread Error!\n");
} else {
add_pvt(tech_pvt, PA_MASTER);
stream->write_function(stream, "SUCCESS:%s:%s\n", tech_pvt->call_id, switch_core_session_get_uuid(tech_pvt->session));
}
} else {
switch_core_session_destroy(&session);
stream->write_function(stream, "FAIL:Device Error!\n");