serve goroutine must refer to the local conn

This commit is contained in:
Sridhar Ratnakumar 2013-04-09 15:00:05 -07:00
parent 40ebe78bb1
commit f731835e45
1 changed files with 3 additions and 3 deletions

View File

@ -138,7 +138,8 @@ func ListenAndServe(proto, addr string, service Service) error {
if err != nil { if err != nil {
return err return err
} }
go func() { go func(conn DockerConn) {
defer conn.Close()
if DEBUG_FLAG { if DEBUG_FLAG {
CLIENT_SOCKET = conn CLIENT_SOCKET = conn
} }
@ -146,8 +147,7 @@ func ListenAndServe(proto, addr string, service Service) error {
log.Println("Error:", err.Error()) log.Println("Error:", err.Error())
fmt.Fprintln(conn, "Error:", err.Error()) fmt.Fprintln(conn, "Error:", err.Error())
} }
conn.Close() }(conn)
}()
} }
} }
return nil return nil