mirror of https://github.com/docker/docs.git
Close tcp connection when client stops '/events' request.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
This commit is contained in:
parent
1b2afce425
commit
59a1f2427b
|
|
@ -46,8 +46,16 @@ func (eh *eventsHandler) Wait(remoteAddr string, until int64) {
|
|||
timer = time.NewTimer(dur)
|
||||
}
|
||||
|
||||
// subscribe to http client close event
|
||||
w := eh.ws[remoteAddr]
|
||||
var closeNotify <-chan bool
|
||||
if closeNotifier, ok := w.(http.CloseNotifier); ok {
|
||||
closeNotify = closeNotifier.CloseNotify()
|
||||
}
|
||||
|
||||
select {
|
||||
case <-eh.cs[remoteAddr]:
|
||||
case <-closeNotify:
|
||||
case <-timer.C: // `--until` timeout
|
||||
close(eh.cs[remoteAddr])
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue