[proxy] Use USR2 signal to tell weavewait when to continue
There was a race condition with containers running and exiting before `weave attach` was finished, which would cause an error.
This commit is contained in:
1 parent
cb92e6b0d2
commit
92444a75eb
3 files changed
+19
-9
No files matched your search
+10
-4
@@ -1,17 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/weaveworks/weave/net"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
_, err := net.EnsureInterface("ethwe", 20)
|
||||
checkErr(err)
|
||||
usr2 := make(chan os.Signal)
|
||||
signal.Notify(usr2, syscall.SIGUSR2)
|
||||
select {
|
||||
case <-usr2:
|
||||
case <-time.After(20 * time.Second):
|
||||
checkErr(errors.New("Container timed out waiting for signal from proxy"))
|
||||
}
|
||||
|
||||
if len(os.Args) <= 1 {
|
||||
os.Exit(0)
|
||||
|
||||
Reference in new issue
Block a user