From bc78e63877db62956e3795c7136cec5900abe73b Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 2 Jul 2018 15:40:32 +0200 Subject: [PATCH] close pipe when finish --- testing/servers/tcp/tcp.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/servers/tcp/tcp.go b/testing/servers/tcp/tcp.go index 4f970c97..c008afdb 100644 --- a/testing/servers/tcp/tcp.go +++ b/testing/servers/tcp/tcp.go @@ -58,6 +58,8 @@ func (server *Server) handleConnection(conn net.Conn) { pReader, pWriter := pipe.New(pipe.WithoutSizeLimit()) err := task.Run(task.Parallel(func() error { + defer pWriter.Close() // nolint: errcheck + for { b := buf.New() if err := b.AppendSupplier(buf.ReadFrom(conn)); err != nil { @@ -72,6 +74,8 @@ func (server *Server) handleConnection(conn net.Conn) { } } }, func() error { + defer pReader.CloseError() + w := buf.NewWriter(conn) for { mb, err := pReader.ReadMultiBuffer()