Skip to content

Commit

Permalink
check for net error closed error instead of hack
Browse files Browse the repository at this point in the history
  • Loading branch information
blixenkrone authored and tklauser committed May 3, 2024
1 parent 4e6c77e commit 48b357e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"runtime/pprof"
"runtime/trace"
"strconv"
"strings"
"sync"
"syscall"
"time"
Expand Down Expand Up @@ -120,8 +119,7 @@ func listen(l net.Listener) {
for {
fd, err := l.Accept()
if err != nil {
// No great way to check for this, see https://golang.org/issues/4373.
if !strings.Contains(err.Error(), "use of closed network connection") {
if !errors.Is(err, net.ErrClosed) {
fmt.Fprintf(os.Stderr, "gops: %v\n", err)
}
if netErr, ok := err.(net.Error); ok && !netErr.Temporary() {
Expand Down

0 comments on commit 48b357e

Please sign in to comment.