Skip to content

Commit

Permalink
fix: drop raw EINVAL (from keepalives) errors as well (#115)
Browse files Browse the repository at this point in the history
It _looks_ like the standard library doesn't always wrap this error.

fixes #113
  • Loading branch information
Stebalien committed Feb 6, 2022
1 parent ece76e8 commit 9d3f10b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2p/transport/tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net"
"os"
"runtime"
"syscall"
"time"

"github.com/libp2p/go-libp2p-core/network"
Expand Down Expand Up @@ -45,7 +46,7 @@ func tryKeepAlive(conn net.Conn, keepAlive bool) {
//
// But there's nothing we can do about invalid arguments, so we'll drop this to a
// debug.
if errors.Is(err, os.ErrInvalid) {
if errors.Is(err, os.ErrInvalid) || errors.Is(err, syscall.EINVAL) {
log.Debugw("failed to enable TCP keepalive", "error", err)
} else {
log.Errorw("failed to enable TCP keepalive", "error", err)
Expand Down

0 comments on commit 9d3f10b

Please sign in to comment.