<p>Kevin Harwell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8878">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">utils_socket: don't reuse port variable<br><br>The port parameter variable was being written over and reused in the 'get_range'<br>random port retrieval section. If a second attempt needed to be made to get a<br>free port then it would end up falling into the first case (port != 0) and<br>cause a concatentation error since port was now a list.<br><br>This patch makes it so the second case uses a completely new variable name.<br><br>Change-Id: I9e540eb5a1edddb9f6dd9ae625a3cdc255e60820<br>---<br>M lib/python/asterisk/utils_socket.py<br>1 file changed, 5 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/78/8878/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/lib/python/asterisk/utils_socket.py b/lib/python/asterisk/utils_socket.py<br>index 1f62f13..158592d 100644<br>--- a/lib/python/asterisk/utils_socket.py<br>+++ b/lib/python/asterisk/utils_socket.py<br>@@ -240,20 +240,20 @@<br>                     socktype, family, attempts)<br> <br>             # Need a random port first<br>-            port = self.get_avail(host, 0, socktype, family)<br>+            avail = self.get_avail(host, 0, socktype, family)<br> <br>             if abs(num) <= 1:<br>-                return port<br>+                return avail<br> <br>             try:<br>-                ports = self.get_avail(<br>-                    host, range(port[0] + step, port[0] + num, step),<br>+                avails = self.get_avail(<br>+                    host, range(avail[0] + step, avail[0] + num, step),<br>                     socktype, family, attempts)<br>             except PortError:<br>                 # At least one port not free, try again<br>                 continue<br> <br>-            return port + ports<br>+            return avail + avails<br> <br>         raise PortError(socktype, family, attempts=attempts)<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8878">change 8878</a>. To unsubscribe, 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/8878"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I9e540eb5a1edddb9f6dd9ae625a3cdc255e60820 </div>
<div style="display:none"> Gerrit-Change-Number: 8878 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>