提交 692935be authored 作者: Michael Jerris's avatar Michael Jerris

tweak socket shutdown to eliminate race

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2694 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 8a0e9ccf
...@@ -553,8 +553,11 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session) ...@@ -553,8 +553,11 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session)
{ {
assert(rtp_session != NULL); assert(rtp_session != NULL);
switch_mutex_lock(rtp_session->flag_mutex); switch_mutex_lock(rtp_session->flag_mutex);
apr_socket_shutdown(rtp_session->sock, APR_SHUTDOWN_READWRITE); if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO); assert(rtp_session->sock != NULL);
apr_socket_shutdown(rtp_session->sock, APR_SHUTDOWN_READWRITE);
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO);
}
switch_mutex_unlock(rtp_session->flag_mutex); switch_mutex_unlock(rtp_session->flag_mutex);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论