From 71179f50992d95b93d60fa65c227ed73f80b1ce7 Mon Sep 17 00:00:00 2001 From: Evan Burkey Date: Mon, 7 Nov 2022 11:06:30 -0800 Subject: [PATCH] fix close bug --- cmd/primetime/main.go | 1 + cmd/smoketest/main.go | 1 + pkg/conn/conn.go | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/primetime/main.go b/cmd/primetime/main.go index f2ecded..7ad3841 100644 --- a/cmd/primetime/main.go +++ b/cmd/primetime/main.go @@ -20,4 +20,5 @@ func main() { } func primetime(c net.Conn) { + defer c.Close() } diff --git a/cmd/smoketest/main.go b/cmd/smoketest/main.go index f90bcf8..717bb7b 100644 --- a/cmd/smoketest/main.go +++ b/cmd/smoketest/main.go @@ -16,6 +16,7 @@ func main() { } func smoketest(c net.Conn) { + defer c.Close() if _, err := io.Copy(c, c); err != nil { log.Fatalln(err) } diff --git a/pkg/conn/conn.go b/pkg/conn/conn.go index 3d928ba..9d266e9 100644 --- a/pkg/conn/conn.go +++ b/pkg/conn/conn.go @@ -25,7 +25,6 @@ func StartSimple(handler func(conn net.Conn)) error { return err } go handler(c) - err = c.Close() if err != nil { return err }