Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #80 from qbit/openbsd_keepalive
Browse files Browse the repository at this point in the history
Skip SetKeepAlivePeriod call on OpenBSD
  • Loading branch information
marten-seemann committed Jun 24, 2021
2 parents 3ea62a3 + 5ab216b commit 1b96803
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tcp.go
Expand Up @@ -3,6 +3,7 @@ package tcp
import (
"context"
"net"
"runtime"
"time"

logging "github.com/ipfs/go-log"
Expand Down Expand Up @@ -41,8 +42,11 @@ func tryKeepAlive(conn net.Conn, keepAlive bool) {
log.Errorf("Failed to enable TCP keepalive: %s", err)
return
}
if err := keepAliveConn.SetKeepAlivePeriod(keepAlivePeriod); err != nil {
log.Errorf("Failed set keepalive period: %s", err)

if runtime.GOOS != "openbsd" {
if err := keepAliveConn.SetKeepAlivePeriod(keepAlivePeriod); err != nil {
log.Errorf("Failed set keepalive period: %s", err)
}
}
}

Expand Down

0 comments on commit 1b96803

Please sign in to comment.