Address possible goroutine leak in notification library

Signed-off-by: Stephen J Day <stephen.day@docker.com>
pull/474/head
Stephen J Day 2015-04-29 18:31:01 -07:00
parent b5bae799e3
commit 2896c32d39
1 changed files with 2 additions and 0 deletions

View File

@ -53,6 +53,7 @@ type httpStatusListener interface {
func (hs *httpSink) Write(events ...Event) error {
hs.mu.Lock()
defer hs.mu.Unlock()
defer hs.client.Transport.(*headerRoundTripper).CloseIdleConnections()
if hs.closed {
return ErrSinkClosed
@ -83,6 +84,7 @@ func (hs *httpSink) Write(events ...Event) error {
return fmt.Errorf("%v: error posting: %v", hs, err)
}
defer resp.Body.Close()
// The notifier will treat any 2xx or 3xx response as accepted by the
// endpoint.