have waitForStartByIdent() return an error
This commit is contained in:
1 parent
949f8bb2e7
commit
f7cb2ef25d
1 file changed
+8
-5
+8
-5
@@ -359,11 +359,11 @@ func (proxy *Proxy) waitForStart(r *http.Request) error {
|
||||
}
|
||||
|
||||
// If some other operation is waiting for a container to start, join in the wait
|
||||
func (proxy *Proxy) waitForStartByIdent(ident string) {
|
||||
var ch chan struct{}
|
||||
func (proxy *Proxy) waitForStartByIdent(ident string) error {
|
||||
var ch chan error
|
||||
proxy.Lock()
|
||||
for _, wait := range proxy.waiters {
|
||||
if ident == wait.ident {
|
||||
if ident == wait.ident && !wait.done {
|
||||
ch = wait.ch
|
||||
break
|
||||
}
|
||||
@@ -371,8 +371,9 @@ func (proxy *Proxy) waitForStartByIdent(ident string) {
|
||||
proxy.Unlock()
|
||||
if ch != nil {
|
||||
Log.Debugf("Wait for start of container %s", ident)
|
||||
<-ch
|
||||
return <-ch
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (proxy *Proxy) ContainerDied(ident string) {
|
||||
@@ -519,7 +520,9 @@ func (proxy *Proxy) updateContainerNetworkSettings(container jsonObject) error {
|
||||
return err
|
||||
}
|
||||
|
||||
proxy.waitForStartByIdent(containerID)
|
||||
if err := proxy.waitForStartByIdent(containerID); err != nil {
|
||||
return err
|
||||
}
|
||||
mac, ips, nets, err := weaveContainerIPs(containerID)
|
||||
if err != nil || len(ips) == 0 {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user