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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">tcptls.c: Don't close TCP client file descriptors more than once<br><br>ASTERISK-28430 #close<br><br>Change-Id: Ib556b0a0c95cca939e956886214ec8d828d89606<br>---<br>M main/tcptls.c<br>1 file changed, 3 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/tcptls.c b/main/tcptls.c</span><br><span>index 6a26cb8..45eb29b 100644</span><br><span>--- a/main/tcptls.c</span><br><span>+++ b/main/tcptls.c</span><br><span>@@ -608,13 +608,8 @@</span><br><span>        return handle_tcptls_connection(tcptls_session);</span><br><span> </span><br><span> client_start_error:</span><br><span style="color: hsl(0, 100%, 40%);">-     if (desc) {</span><br><span style="color: hsl(0, 100%, 40%);">-             close(desc->accept_fd);</span><br><span style="color: hsl(0, 100%, 40%);">-              desc->accept_fd = -1;</span><br><span style="color: hsl(0, 100%, 40%);">-        }</span><br><span>    ao2_ref(tcptls_session, -1);</span><br><span>         return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> }</span><br><span> </span><br><span> struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_session_args *desc)</span><br><span>@@ -631,10 +626,6 @@</span><br><span>   /* If we return early, there is no connection */</span><br><span>     ast_sockaddr_setnull(&desc->old_address);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    if (desc->accept_fd != -1) {</span><br><span style="color: hsl(0, 100%, 40%);">-         close(desc->accept_fd);</span><br><span style="color: hsl(0, 100%, 40%);">-      }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>    fd = desc->accept_fd = socket(ast_sockaddr_is_ipv6(&desc->remote_address) ?</span><br><span>                                      AF_INET6 : AF_INET, SOCK_STREAM, IPPROTO_TCP);</span><br><span>         if (desc->accept_fd < 0) {</span><br><span>@@ -672,6 +663,9 @@</span><br><span>               goto error;</span><br><span>  }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* From here on out, the iostream owns the accept_fd and it will take</span><br><span style="color: hsl(120, 100%, 40%);">+  * care of closing it when the iostream is closed */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>       tcptls_session->parent = desc;</span><br><span>    tcptls_session->parent->worker_fn = NULL;</span><br><span>      ast_sockaddr_copy(&tcptls_session->remote_address,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15024">change 15024</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/+/15024"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Ib556b0a0c95cca939e956886214ec8d828d89606 </div>
<div style="display:none"> Gerrit-Change-Number: 15024 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </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 Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>