mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 13:44:03 +03:00
Fix Keep-Alive Issue for OpenBSD/ArchLinux
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user