From: David Vossel Date: Tue, 1 Mar 2011 16:05:25 +0000 (+0000) Subject: Fixes thread blocking issue in the sip TCP/TLS implementation. X-Git-Tag: 1.6.2.19-rc1~3^2~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3ff344e1216c688b4f256ac072673e0553157db;p=thirdparty%2Fasterisk.git Fixes thread blocking issue in the sip TCP/TLS implementation. (closes issue #18497) Reported by: vois Patches: issues_18497.diff uploaded by dvossel (license 671) Tested by: vois, rossbeer, kowalma, Freddi_Fonet git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@309083 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 85ffa1a5a3..af6d3fbb5d 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3061,14 +3061,15 @@ static void *_sip_tcp_helper_thread(struct sip_pvt *pvt, struct ast_tcptls_sessi ao2_lock(me); if (!(packet = AST_LIST_REMOVE_HEAD(&me->packet_q, entry))) { ast_log(LOG_WARNING, "TCPTLS thread alert_pipe indicated packet should be sent, but frame_q is empty"); - } else if (ast_tcptls_server_write(tcptls_session, ast_str_buffer(packet->data), packet->len) == -1) { - ast_log(LOG_WARNING, "Failure to write to tcp/tls socket\n"); } + ao2_unlock(me); if (packet) { + if (ast_tcptls_server_write(tcptls_session, ast_str_buffer(packet->data), packet->len) == -1) { + ast_log(LOG_WARNING, "Failure to write to tcp/tls socket\n"); + } ao2_t_ref(packet, -1, "tcptls packet sent, this is no longer needed"); } - ao2_unlock(me); break; default: ast_log(LOG_ERROR, "Unknown tcptls thread alert '%d'\n", alert);