packer/rpc: Close the net conn after done sending data for Comm

This commit is contained in:
Mitchell Hashimoto 2013-05-27 23:36:34 -07:00
parent 78ab1709cd
commit 7154b5c0f1
1 changed files with 4 additions and 0 deletions

View File

@ -222,6 +222,10 @@ func serveSingleCopy(name string, l net.Listener, dst io.Writer, src io.Reader)
return
}
// Be sure to close the connection after we're done copying so
// that an EOF will successfully be sent to the remote side
defer conn.Close()
// The connection is the destination/source that is nil
if dst == nil {
dst = conn