From f731835e4577c414d37fa050aaec1f541511ff6b Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Tue, 9 Apr 2013 15:00:05 -0700 Subject: [PATCH] serve goroutine must refer to the local conn --- rcli/tcp.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rcli/tcp.go b/rcli/tcp.go index e9dba7f319..cf111cdf71 100644 --- a/rcli/tcp.go +++ b/rcli/tcp.go @@ -138,7 +138,8 @@ func ListenAndServe(proto, addr string, service Service) error { if err != nil { return err } - go func() { + go func(conn DockerConn) { + defer conn.Close() if DEBUG_FLAG { CLIENT_SOCKET = conn } @@ -146,8 +147,7 @@ func ListenAndServe(proto, addr string, service Service) error { log.Println("Error:", err.Error()) fmt.Fprintln(conn, "Error:", err.Error()) } - conn.Close() - }() + }(conn) } } return nil