mirror of https://github.com/docker/docs.git
Merge pull request #12 from tutumcloud/fix-acceptconnections
This commit is contained in:
commit
c4b3c7e839
|
@ -10,7 +10,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -54,6 +53,7 @@ func cmdDaemon(c *cli.Context) {
|
||||||
front.Logging = false
|
front.Logging = false
|
||||||
// FIXME: server should expose an engine.Installer
|
// FIXME: server should expose an engine.Installer
|
||||||
front.Register(c.App.Name, server.ServeApi)
|
front.Register(c.App.Name, server.ServeApi)
|
||||||
|
front.Register("acceptconnections", server.AcceptConnections)
|
||||||
front.RegisterCatchall(func(job *engine.Job) engine.Status {
|
front.RegisterCatchall(func(job *engine.Job) engine.Status {
|
||||||
fw := back.Job(job.Name, job.Args...)
|
fw := back.Job(job.Name, job.Args...)
|
||||||
fw.Stdout.Add(job.Stdout)
|
fw.Stdout.Add(job.Stdout)
|
||||||
|
@ -75,9 +75,6 @@ func cmdDaemon(c *cli.Context) {
|
||||||
Fatalf("serveapi: %v", err)
|
Fatalf("serveapi: %v", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// There is a race condition in engine.ServeApi.
|
|
||||||
// As a workaround we sleep to give it time to register 'acceptconnections'.
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
// Notify that we're ready to receive connections
|
// Notify that we're ready to receive connections
|
||||||
if err := front.Job("acceptconnections").Run(); err != nil {
|
if err := front.Job("acceptconnections").Run(); err != nil {
|
||||||
Fatalf("acceptconnections: %v", err)
|
Fatalf("acceptconnections: %v", err)
|
||||||
|
|
Loading…
Reference in New Issue