From c81bf10b0ad96c0aab655660a5c2ac58def09873 Mon Sep 17 00:00:00 2001 From: Kroese Date: Thu, 28 Dec 2023 08:21:58 +0100 Subject: [PATCH] fix: Hide reset by peer * fix: Hide reset by peer --- src/main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.go b/src/main.go index 647f92f..534cacb 100644 --- a/src/main.go +++ b/src/main.go @@ -10,8 +10,10 @@ import ( "flag" "sync" "bytes" - "strconv" + "errors" "strings" + "syscall" + "strconv" "os/exec" "net/http" "math/rand" @@ -141,10 +143,10 @@ func incoming_conn(conn net.Conn) { len, err := conn.Read(buf) if err != nil { - if err != io.EOF { - log.Println("Read error:", err) - } else { + if err == io.EOF || errors.Is(err, syscall.ECONNRESET) { fmt.Println("Disconnected:", err) + } else { + log.Println("Read error:", err) } if len != Packet { return } }