mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Change switch to if so that the break statements correctly breaks loop
Docker-DCO-1.1-Signed-off-by: Kohei Tsuruta <coheyxyz@gmail.com> (github: coheyxyz)
This commit is contained in:
parent
3b3f0fa085
commit
ffe885ec0e
1 changed files with 2 additions and 3 deletions
|
@ -415,8 +415,7 @@ func AllocatePort(job *engine.Job) engine.Status {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
switch allocerr := err.(type) {
|
if allocerr, ok := err.(portallocator.ErrPortAlreadyAllocated); ok {
|
||||||
case portallocator.ErrPortAlreadyAllocated:
|
|
||||||
// There is no point in immediately retrying to map an explicitly
|
// There is no point in immediately retrying to map an explicitly
|
||||||
// chosen port.
|
// chosen port.
|
||||||
if hostPort != 0 {
|
if hostPort != 0 {
|
||||||
|
@ -426,7 +425,7 @@ func AllocatePort(job *engine.Job) engine.Status {
|
||||||
|
|
||||||
// Automatically chosen 'free' port failed to bind: move on the next.
|
// Automatically chosen 'free' port failed to bind: move on the next.
|
||||||
job.Logf("Failed to bind %s for container address %s. Trying another port.", allocerr.IPPort(), container.String())
|
job.Logf("Failed to bind %s for container address %s. Trying another port.", allocerr.IPPort(), container.String())
|
||||||
default:
|
} else {
|
||||||
// some other error during mapping
|
// some other error during mapping
|
||||||
job.Logf("Received an unexpected error during port allocation: %s", err.Error())
|
job.Logf("Received an unexpected error during port allocation: %s", err.Error())
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue