<p>Joshua C. Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13366">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua C. Colp: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_sip:  in case of tcp/tls, be less annoying about tx errors.<br><br>chan_sip.c:3782 __sip_xmit: sip_xmit of 0x7f1478069230 (len 600) to<br>213.150.203.60:1492 returned -2: Interrupted system call<br><br>returned -2 implies this wasn't actually an OS error, so errno makes no<br>sense either.  Internal error was already logged higher up, and -2<br>generally means that either there isn't a valid connection available, or<br>the pipe notification failed, and that is already correctly logged.<br><br>ASTERISK-28651 #close<br><br>Change-Id: I46eb82924beeff9dfd86fa6c7eb87d2651b950f2<br>Signed-off-by: Jaco Kroon <jaco@uls.co.za><br>---<br>M channels/chan_sip.c<br>1 file changed, 12 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_sip.c b/channels/chan_sip.c</span><br><span>index ea78d23..064e6ef 100644</span><br><span>--- a/channels/chan_sip.c</span><br><span>+++ b/channels/chan_sip.c</span><br><span>@@ -2568,13 +2568,17 @@</span><br><span> </span><br><span>     ao2_lock(tcptls_session);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if ((tcptls_session->fd == -1) ||</span><br><span style="color: hsl(0, 100%, 40%);">-            !(th = ao2_t_find(threadt, &tmp, OBJ_POINTER, "ao2_find, getting sip_threadinfo in tcp helper thread")) ||</span><br><span style="color: hsl(120, 100%, 40%);">+      if (tcptls_session->fd == -1 ||</span><br><span>           !(packet = ao2_alloc(sizeof(*packet), tcptls_packet_destructor)) ||</span><br><span>          !(packet->data = ast_str_create(len))) {</span><br><span>          goto tcptls_write_setup_error;</span><br><span>       }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (!(th = ao2_t_find(threadt, &tmp, OBJ_POINTER, "ao2_find, getting sip_threadinfo in tcp helper thread"))) {</span><br><span style="color: hsl(120, 100%, 40%);">+          ast_log(LOG_ERROR, "Unable to locate tcptls_session helper thread.\n");</span><br><span style="color: hsl(120, 100%, 40%);">+             goto tcptls_write_setup_error;</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* goto tcptls_write_error should _NOT_ be used beyond this point */</span><br><span>         ast_str_set(&packet->data, 0, "%s", (char *) buf);</span><br><span>  packet->len = len;</span><br><span>@@ -3758,6 +3762,9 @@</span><br><span>                res = ast_sendto(p->socket.fd, ast_str_buffer(data), ast_str_strlen(data), 0, dst);</span><br><span>       } else if (p->socket.tcptls_session) {</span><br><span>            res = sip_tcptls_write(p->socket.tcptls_session, ast_str_buffer(data), ast_str_strlen(data));</span><br><span style="color: hsl(120, 100%, 40%);">+              if (res < -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    return res;</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span>    } else if (p->socket.ws_session) {</span><br><span>                if (!(res = ast_websocket_write_string(p->socket.ws_session, ast_str_buffer(data)))) {</span><br><span>                    /* The WebSocket API just returns 0 on success and -1 on failure, while this code expects the payload length to be returned */</span><br><span>@@ -30160,6 +30167,9 @@</span><br><span>                (peer->socket.tcptls_session) &&</span><br><span>                  (peer->socket.tcptls_session->fd != -1)) {</span><br><span>          res = sip_tcptls_write(peer->socket.tcptls_session, keepalive, count);</span><br><span style="color: hsl(120, 100%, 40%);">+             if (res < -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span>    } else if (peer->socket.type == AST_TRANSPORT_UDP) {</span><br><span>              res = ast_sendto(sipsock, keepalive, count, 0, &peer->addr);</span><br><span>  }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13366">change 13366</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13366"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: I46eb82924beeff9dfd86fa6c7eb87d2651b950f2 </div>
<div style="display:none"> Gerrit-Change-Number: 13366 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Jaco Kroon <jaco@uls.co.za> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-CC: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>