Commit Graph

8 Commits

Author SHA1 Message Date
47d12f79de fixed the way of iterating over the range of map.
Fixed the following errors:
1. Request(0) causes a dead loop when the map is full and map.last == BEGIN.
2. When map.last is the only available port (or ip), Request(0) returns ErrAllPortsAllocated (or ErrNoAvailableIPs). Exception is when map.last == BEGIN.

Signed-off-by: shuai-z <zs.broccoli@gmail.com>
Upstream-commit: 4c978322979f00408c72b50931a8cdea2d5cdefc
Component: engine
2014-11-04 13:46:53 +08:00
b91a2b389f added test, gofmtd
Signed-off-by: shuai-z <zs.broccoli@gmail.com>
Upstream-commit: 2c2edabca5471fa969358cb98619f277d585e76c
Component: engine
2014-10-23 11:35:12 +08:00
79574eea31 Port number 49153(BeginPortRange) would be returned twice, causing duplication and potential errors.
If we first request port 49153 (BeginPortRange) explicitly, and later some time request the next free port (of same ip/proto) by calling RequestPort() with port number 0, we will again get 49153 returned, even if it's currently in use. Because findPort() blindly retured BeginPortRange the first run, without checking if it has already been taken.

Signed-off-by: shuai-z <zs.broccoli@gmail.com>
Upstream-commit: 9451cf39eff037eccb04319c1e601d08495cab3c
Component: engine
2014-10-23 10:49:33 +08:00
e3c0c2772d Refactoring portallocator
Faster, more documented, less code.
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Upstream-commit: f387cc1205b79ffbe30b28f5df13da034d8221fd
Component: engine
2014-07-01 21:59:11 +04:00
4ad46ffe31 Use last allocated port logic in port allocator
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: e77729c2e081c5ce55aa1d4f316b7c7703e5de96
Component: engine
2014-06-27 10:51:26 -07:00
52ddc2736f Make ErrPortAlreadyAllocated an error interface with a few extras,
adjust tests to fit.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: ffd68badc0a3d70fbd063903702355a387621b10
Component: engine
2014-06-27 10:51:25 -07:00
ff6d32db91 portallocator: rewrite to simplify, removes race condition
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: f0489ce3a9a4023265bbbd5e9cb333e95f950088
Component: engine
2014-05-21 09:14:53 -07:00
f7be50364d Rename runtime/* to daemon/*
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 359b7df5d2af5733b8a1ea6746d062053053b23e
Component: engine
2014-04-17 14:43:01 -07:00