make listen buffer optional

Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
Victor Vieux 2014-05-01 23:07:11 +00:00
parent a0f799b6d4
commit f3736265fd
2 changed files with 7 additions and 1 deletions

View file

@ -1193,6 +1193,7 @@ func changeGroup(addr string, nameOrGid string) error {
// ListenAndServe sets up the required http.Server and gets it listening for
// each addr passed in and does protocol specific checking.
func ListenAndServe(proto, addr string, job *engine.Job) error {
var l net.Listener
r, err := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("Version"))
if err != nil {
return err
@ -1208,7 +1209,11 @@ func ListenAndServe(proto, addr string, job *engine.Job) error {
}
}
l, err := listenbuffer.NewListenBuffer(proto, addr, activationLock)
if job.GetenvBool("BufferRequests") {
l, err = listenbuffer.NewListenBuffer(proto, addr, activationLock)
} else {
l, err = net.Listen(proto, addr)
}
if err != nil {
return err
}

View file

@ -185,6 +185,7 @@ func main() {
job.Setenv("TlsCa", *flCa)
job.Setenv("TlsCert", *flCert)
job.Setenv("TlsKey", *flKey)
job.SetenvBool("BuffferRequests", true)
if err := job.Run(); err != nil {
log.Fatal(err)
}