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
|
// If some other operation is waiting for a container to start, join in the wait
|
||||||
func (proxy *Proxy) waitForStartByIdent(ident string) {
|
func (proxy *Proxy) waitForStartByIdent(ident string) error {
|
||||||
var ch chan struct{}
|
var ch chan error
|
||||||
proxy.Lock()
|
proxy.Lock()
|
||||||
for _, wait := range proxy.waiters {
|
for _, wait := range proxy.waiters {
|
||||||
if ident == wait.ident {
|
if ident == wait.ident && !wait.done {
|
||||||
ch = wait.ch
|
ch = wait.ch
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -371,8 +371,9 @@ func (proxy *Proxy) waitForStartByIdent(ident string) {
|
|||||||
proxy.Unlock()
|
proxy.Unlock()
|
||||||
if ch != nil {
|
if ch != nil {
|
||||||
Log.Debugf("Wait for start of container %s", ident)
|
Log.Debugf("Wait for start of container %s", ident)
|
||||||
<-ch
|
return <-ch
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (proxy *Proxy) ContainerDied(ident string) {
|
func (proxy *Proxy) ContainerDied(ident string) {
|
||||||
@@ -519,7 +520,9 @@ func (proxy *Proxy) updateContainerNetworkSettings(container jsonObject) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy.waitForStartByIdent(containerID)
|
if err := proxy.waitForStartByIdent(containerID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
mac, ips, nets, err := weaveContainerIPs(containerID)
|
mac, ips, nets, err := weaveContainerIPs(containerID)
|
||||||
if err != nil || len(ips) == 0 {
|
if err != nil || len(ips) == 0 {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in new issue
Block a user