Merge pull request #151 from FollowMeDown/master

Fix Keep-Alive Issue for OpenBSD/ArchLinux
This commit is contained in:
Sergey Arkhipov
2020-08-10 12:49:16 +03:00
committed by GitHub
-7
View File
@@ -3,11 +3,8 @@ package utils
import (
"fmt"
"net"
"time"
)
const tcpKeepAlivePingPeriod = 2 * time.Second
func InitTCP(conn net.Conn, readBufferSize int, writeBufferSize int) error {
tcpConn := conn.(*net.TCPConn)
@@ -27,9 +24,5 @@ func InitTCP(conn net.Conn, readBufferSize int, writeBufferSize int) error {
return fmt.Errorf("cannot enable keep-alive: %w", err)
}
if err := tcpConn.SetKeepAlivePeriod(tcpKeepAlivePingPeriod); err != nil {
return fmt.Errorf("cannot set keep-alive period: %w", err)
}
return nil
}