GitHub user mattunderscorechampion opened a pull request:
https://github.com/apache/incubator-brooklyn/pull/480
Release ports acquired when checking available
Fixes issue
[BROOKLYN-130](https://issues.apache.org/jira/browse/BROOKLYN-130). Ensures
that the setReuseAddress is called before the port is bound. Removes the
attempt to connect to the port before binding it as unnecessary. Corrected off
by one error in loop so that port is not incremented beyond MAX_PORT_NUMBER.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/pushtechnology/incubator-brooklyn
correctPortRelease
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-brooklyn/pull/480.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #480
----
commit 0b5a77d4f3f8b4e5c1975d67c9cfddbab8a629eb
Author: Matt Champion <[email protected]>
Date: 2015-01-27T17:20:51Z
Bind the socket after setting SO_REUSEADDR to true, behaviour is undefined
the other way around
commit 5004bfee4c1ad6f98f3a61b9f697022ef59de70f
Author: Matt Champion <[email protected]>
Date: 2015-01-27T20:40:30Z
Ensure that the datagram socket is created in an unbound state
commit 34439f4a2ac0c13781a8485c4d6d308fb744de47
Author: Matt Champion <[email protected]>
Date: 2015-01-27T20:43:58Z
Removed unnecessary double checking of free port
commit f673e19910eaf160b2ba1c93e0d6a0d23a265f27
Author: Matt Champion <[email protected]>
Date: 2015-01-27T20:58:43Z
Fixed off by one error. After MAX_PORT_NUMBER comparison port is
incremented and checked. If not in valid range isPortAvailable throws an
exception which is less descriptive than the one in nextAvailablePort.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---