提交 bf201fc0 authored 作者: Anthony Minessale's avatar Anthony Minessale

fix potential race

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10828 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 3d981b49
......@@ -373,6 +373,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
switch_safe_free(stream.data);
}
switch_clear_flag(tech_pvt, TFLAG_IO);
if (tech_pvt->read_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
......@@ -385,7 +387,6 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
switch_core_session_unset_write_codec(session);
switch_mutex_lock(tech_pvt->profile->flag_mutex);
switch_clear_flag(tech_pvt, TFLAG_IO);
tech_pvt->profile->inuse--;
switch_mutex_unlock(tech_pvt->profile->flag_mutex);
......@@ -656,6 +657,10 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
tech_pvt->read_frame.datalen = 0;
switch_set_flag_locked(tech_pvt, TFLAG_READING);
if (switch_test_flag(tech_pvt, TFLAG_HUP) || switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
return SWITCH_STATUS_FALSE;
}
if (switch_test_flag(tech_pvt, TFLAG_IO)) {
switch_status_t status;
......@@ -845,6 +850,10 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
return SWITCH_STATUS_SUCCESS;
}
if (switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
return SWITCH_STATUS_FALSE;
}
switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论