1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

Merge pull request #13966 from mountkin/fix-stats-goroutine-leak

fix the goroutine leak in the stats API if the container is not running
This commit is contained in:
David Calavera
2015-06-23 10:06:35 -07:00
4 changed files with 86 additions and 21 deletions

View File

@ -582,7 +582,18 @@ func (s *Server) getContainersStats(version version.Version, w http.ResponseWrit
out = ioutils.NewWriteFlusher(w)
}
return s.daemon.ContainerStats(vars["name"], stream, out)
var closeNotifier <-chan bool
if notifier, ok := w.(http.CloseNotifier); ok {
closeNotifier = notifier.CloseNotify()
}
config := &daemon.ContainerStatsConfig{
Stream: stream,
OutStream: out,
Stop: closeNotifier,
}
return s.daemon.ContainerStats(vars["name"], config)
}
func (s *Server) getContainersLogs(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {