Skip to content

Commit

Permalink
fix: Hide reset by peer
Browse files Browse the repository at this point in the history
* fix: Hide reset by peer
  • Loading branch information
kroese authored Dec 28, 2023
1 parent f8568df commit c81bf10
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import (
"flag"
"sync"
"bytes"
"strconv"
"errors"
"strings"
"syscall"
"strconv"
"os/exec"
"net/http"
"math/rand"
Expand Down Expand Up @@ -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 }
}
Expand Down

0 comments on commit c81bf10

Please sign in to comment.