提交 21465836 authored 作者: Giovanni Maruzzelli's avatar Giovanni Maruzzelli

skypopen: adding some guards against NULL sessions and channels

上级 b65a3ebd
...@@ -1739,6 +1739,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) ...@@ -1739,6 +1739,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
if (session) { if (session) {
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
if(channel){
switch_mutex_lock(tech_pvt->flag_mutex); switch_mutex_lock(tech_pvt->flag_mutex);
switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_IO);
...@@ -1752,6 +1753,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj) ...@@ -1752,6 +1753,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
switch_core_session_rwunlock(session); switch_core_session_rwunlock(session);
WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename); WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename);
switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); switch_channel_hangup(channel, SWITCH_CAUSE_CRASH);
} else {
WARNINGA("NO CHANNEL ?\n", SKYPOPEN_P_LOG);
}
} }
WARNINGA("Removing skype interface %s\n", SKYPOPEN_P_LOG, interfacename); WARNINGA("Removing skype interface %s\n", SKYPOPEN_P_LOG, interfacename);
...@@ -1772,6 +1776,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) ...@@ -1772,6 +1776,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
if(channel){
switch_mutex_lock(tech_pvt->flag_mutex); switch_mutex_lock(tech_pvt->flag_mutex);
switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_IO);
switch_clear_flag(tech_pvt, TFLAG_VOICE); switch_clear_flag(tech_pvt, TFLAG_VOICE);
...@@ -1785,6 +1790,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj) ...@@ -1785,6 +1790,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename); WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename);
switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); switch_channel_hangup(channel, SWITCH_CAUSE_CRASH);
} else {
WARNINGA("NO CHANNEL ?\n", SKYPOPEN_P_LOG);
}
//skypopen_sleep(500000); //skypopen_sleep(500000);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论