fix close bug

This commit is contained in:
Evan Burkey 2022-11-07 11:06:30 -08:00
parent 9a8cf96e08
commit 71179f5099
3 changed files with 2 additions and 1 deletions

View File

@ -20,4 +20,5 @@ func main() {
} }
func primetime(c net.Conn) { func primetime(c net.Conn) {
defer c.Close()
} }

View File

@ -16,6 +16,7 @@ func main() {
} }
func smoketest(c net.Conn) { func smoketest(c net.Conn) {
defer c.Close()
if _, err := io.Copy(c, c); err != nil { if _, err := io.Copy(c, c); err != nil {
log.Fatalln(err) log.Fatalln(err)
} }

View File

@ -25,7 +25,6 @@ func StartSimple(handler func(conn net.Conn)) error {
return err return err
} }
go handler(c) go handler(c)
err = c.Close()
if err != nil { if err != nil {
return err return err
} }