[Asterisk-code-review] sipp, test suite utils: Default media port to an unused port (testsuite[master])

Corey Farrell asteriskteam at digium.com
Wed Apr 18 10:52:11 CDT 2018


Corey Farrell has posted comments on this change. ( https://gerrit.asterisk.org/8691 )

Change subject: sipp, test_suite_utils: Default media port to an unused port
......................................................................


Patch Set 5: Code-Review-1

(4 comments)

https://gerrit.asterisk.org/#/c/8691/5/lib/python/asterisk/utils_socket.py
File lib/python/asterisk/utils_socket.py:

https://gerrit.asterisk.org/#/c/8691/5/lib/python/asterisk/utils_socket.py@222
PS5, Line 222:         empty list.
Is this true?  Seems like we throw an exception if we cannot get ports (or we should).


https://gerrit.asterisk.org/#/c/8691/5/lib/python/asterisk/utils_socket.py@228
PS5, Line 228:                 return self.get_avail(host, range(port, port + span + step,
This grabs an excess port if span > 0.  If span = 4:
range(port, port + 4 + 1, 1) gives a list of 5 ports.


https://gerrit.asterisk.org/#/c/8691/5/lib/python/asterisk/utils_socket.py@233
PS5, Line 233:             ports = self.get_avail(host, range(port[0] + 1, port[0] + span +
I think this grabs excess ports.  Example:
When we call this with port=0, span=4 would indicate we want a list of 4 ports.  port = self.get_avail(host, 0,...) gets the first port which means we need 3 more.  range(port[0] + 1, port[0] + 4 + 1, 1) gives us 4 more ports but we only want 3 more.


https://gerrit.asterisk.org/#/c/8691/5/lib/python/asterisk/utils_socket.py@238
PS5, Line 238:         PortError(socktype, family, attempts)
Do you not need to 'raise PortError(...)'?



-- 
To view, visit https://gerrit.asterisk.org/8691
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3da461123afc30e1f5ca12e65d289eaa42d6de00
Gerrit-Change-Number: 8691
Gerrit-PatchSet: 5
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Comment-Date: Wed, 18 Apr 2018 15:52:11 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180418/c4e90721/attachment.html>


More information about the asterisk-code-review mailing list