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

Kevin Harwell asteriskteam at digium.com
Thu Apr 19 13:44:12 CDT 2018


Kevin Harwell 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:

(2 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@233
PS5, Line 233: range(port[0] + 1, port[0] + span +
             :                 step, step)
> Wouldn't this path still be taken if span is 0? There aren't any checks for
It's possible. That path will be taken if both port and span are zero. If port is zero then a random unused one is first chosen by the OS. Then we want to check if any "span" ports are available too.

It does add +1 here as I was initially not including the primary port in the "span" count. However, after discussing with Corey a bit I'm going to change it to be inclusive.

Also, you are correct that the documentation is wrong. That should be port not span.


https://gerrit.asterisk.org/#/c/8691/5/lib/python/asterisk/utils_socket.py@259
PS5, Line 259:         res = self.get_spanned(host, port, socktype, family, span, attempts)
> Just for an early return to not have to call reserve, but this is just a sm
I'm fixing it os non available ones will now throw an exception instead of returning an empty list.



-- 
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: Benjamin Keith Ford <bford 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: Thu, 19 Apr 2018 18:44:12 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180419/6312e80f/attachment.html>


More information about the asterisk-code-review mailing list