<p>Alexander Traud has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15137">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_sip: Remove unused sip_socket->port.<br><br>12 years ago, with ASTERISK_12115 the last four get/uses of socket.port<br>vanished. However, the struct member itself and all seven set/uses<br>remained as dead code.<br><br>ASTERISK-28798<br><br>Change-Id: Ib90516a49eca3d724a70191278aaf2144fb58c59<br>---<br>M channels/chan_sip.c<br>M channels/sip/include/sip.h<br>2 files changed, 3 insertions(+), 24 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/37/15137/1</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 dc14661..ad4f968 100644</span><br><span>--- a/channels/chan_sip.c</span><br><span>+++ b/channels/chan_sip.c</span><br><span>@@ -3121,10 +3121,8 @@</span><br><span> </span><br><span> if (ast_iostream_get_ssl(tcptls_session->stream)) {</span><br><span> set_socket_transport(&req.socket, AST_TRANSPORT_TLS);</span><br><span style="color: hsl(0, 100%, 40%);">- req.socket.port = htons(ourport_tls);</span><br><span> } else {</span><br><span> set_socket_transport(&req.socket, AST_TRANSPORT_TCP);</span><br><span style="color: hsl(0, 100%, 40%);">- req.socket.port = htons(ourport_tcp);</span><br><span> }</span><br><span> req.socket.fd = ast_iostream_get_fd(tcptls_session->stream);</span><br><span> </span><br><span>@@ -6403,10 +6401,8 @@</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!dialog->socket.type)</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!dialog->socket.type) {</span><br><span> set_socket_transport(&dialog->socket, AST_TRANSPORT_UDP);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!dialog->socket.port) {</span><br><span style="color: hsl(0, 100%, 40%);">- dialog->socket.port = htons(ast_sockaddr_port(&bindaddr));</span><br><span> }</span><br><span> </span><br><span> if (!ast_sockaddr_port(&dialog->sa)) {</span><br><span>@@ -15149,7 +15145,6 @@</span><br><span> ast_string_field_set(mwi->call, peersecret, mwi->secret);</span><br><span> }</span><br><span> set_socket_transport(&mwi->call->socket, mwi->transport);</span><br><span style="color: hsl(0, 100%, 40%);">- mwi->call->socket.port = htons(mwi->portno);</span><br><span> ast_sip_ouraddrfor(&mwi->call->sa, &mwi->call->ourip, mwi->call);</span><br><span> build_via(mwi->call);</span><br><span> </span><br><span>@@ -16263,19 +16258,8 @@</span><br><span> ast_string_field_set(p, exten, r->callback);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* Set transport and port so the correct contact is built */</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Set transport so the correct contact is built */</span><br><span> set_socket_transport(&p->socket, r->transport);</span><br><span style="color: hsl(0, 100%, 40%);">- if (r->transport == AST_TRANSPORT_TLS || r->transport == AST_TRANSPORT_TCP) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_sockaddr_isnull(&sip_tcp_desc.local_address)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR,</span><br><span style="color: hsl(0, 100%, 40%);">- "TCP/TLS clients without server were not tested.\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR,</span><br><span style="color: hsl(0, 100%, 40%);">- "Please, follow-up and report at issue 28798.\n");</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- p->socket.port =</span><br><span style="color: hsl(0, 100%, 40%);">- htons(ast_sockaddr_port(&sip_tcp_desc.local_address));</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> </span><br><span> /*</span><br><span> check which address we should use in our contact header</span><br><span>@@ -29423,8 +29407,7 @@</span><br><span> </span><br><span> req.socket.fd = sipsock;</span><br><span> set_socket_transport(&req.socket, AST_TRANSPORT_UDP);</span><br><span style="color: hsl(0, 100%, 40%);">- req.socket.tcptls_session = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- req.socket.port = htons(ast_sockaddr_port(&bindaddr));</span><br><span style="color: hsl(120, 100%, 40%);">+ req.socket.tcptls_session = NULL;</span><br><span> </span><br><span> handle_request_do(&req, &addr);</span><br><span> deinit_req(&req);</span><br><span>@@ -32365,9 +32348,6 @@</span><br><span> (peer->socket.type & AST_TRANSPORT_TLS) ?</span><br><span> STANDARD_TLS_PORT : STANDARD_SIP_PORT);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!peer->socket.port) {</span><br><span style="color: hsl(0, 100%, 40%);">- peer->socket.port = htons(((peer->socket.type & AST_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT));</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> </span><br><span> if (realtime) {</span><br><span> int enablepoke = 1;</span><br><span>diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h</span><br><span>index ca26fa3..5737d25 100644</span><br><span>--- a/channels/sip/include/sip.h</span><br><span>+++ b/channels/sip/include/sip.h</span><br><span>@@ -790,7 +790,6 @@</span><br><span> struct sip_socket {</span><br><span> enum ast_transport type; /*!< UDP, TCP or TLS */</span><br><span> int fd; /*!< Filed descriptor, the actual socket */</span><br><span style="color: hsl(0, 100%, 40%);">- uint16_t port;</span><br><span> struct ast_tcptls_session_instance *tcptls_session; /* If tcp or tls, a socket manager */</span><br><span> struct ast_websocket *ws_session; /*! If ws or wss, a WebSocket session */</span><br><span> };</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15137">change 15137</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/+/15137"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib90516a49eca3d724a70191278aaf2144fb58c59 </div>
<div style="display:none"> Gerrit-Change-Number: 15137 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>