Merge pull request #19420 from clnperez/close-notify-fix

Move closeNotify to fix panic with newer golang
This commit is contained in:
Brian Goff 2016-01-18 20:08:25 -05:00
commit b6be645197

View file

@ -227,10 +227,11 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
if closeNotifier, ok := w.(http.CloseNotifier); ok {
finished := make(chan struct{})
defer close(finished)
clientGone := closeNotifier.CloseNotify()
go func() {
select {
case <-finished:
case <-closeNotifier.CloseNotify():
case <-clientGone:
logrus.Infof("Client disconnected, cancelling job: build")
b.Cancel()
}