]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 309083 via svnmerge from
authorDavid Vossel <dvossel@digium.com>
Tue, 1 Mar 2011 16:09:11 +0000 (16:09 +0000)
committerDavid Vossel <dvossel@digium.com>
Tue, 1 Mar 2011 16:09:11 +0000 (16:09 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
  r309083 | dvossel | 2011-03-01 10:05:25 -0600 (Tue, 01 Mar 2011) | 9 lines

  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.8@309084 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 73f24ad43f9aeba0ec3e6398ed6f05485a01b7a5..673a4408aab2e63dd8f456996c619df643b815f5 100644 (file)
@@ -2589,14 +2589,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);