mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Be more explicit in finding next port to allocate
Docker-DCO-1.1-Signed-off-by: Andy Kipp <andy@rstudio.com> (github: kippandrew)
This commit is contained in:
parent
7a1db291fc
commit
73c416a20d
1 changed files with 3 additions and 2 deletions
|
@ -151,8 +151,9 @@ func equalsDefault(ip net.IP) bool {
|
|||
}
|
||||
|
||||
func findNextPort(proto string, allocated *collections.OrderedIntSet) (int, error) {
|
||||
port := 0
|
||||
for port = nextPort(proto); allocated.Exists(port); port = nextPort(proto) {
|
||||
port := nextPort(proto)
|
||||
for allocated.Exists(port) {
|
||||
port = nextPort(proto)
|
||||
}
|
||||
if port > EndPortRange {
|
||||
return 0, ErrPortExceedsRange
|
||||
|
|
Loading…
Reference in a new issue