From 7154b5c0f1986957f8fc84b5740c7fce78f84de0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 27 May 2013 23:36:34 -0700 Subject: [PATCH] packer/rpc: Close the net conn after done sending data for Comm --- packer/rpc/communicator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packer/rpc/communicator.go b/packer/rpc/communicator.go index 857b92277..b16c94e6f 100644 --- a/packer/rpc/communicator.go +++ b/packer/rpc/communicator.go @@ -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