mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 10:54:02 +03:00
Propagate keep alive settings from the config
This commit is contained in:
@@ -5,13 +5,8 @@ import (
|
||||
"net"
|
||||
)
|
||||
|
||||
func setCommonSocketOptions(conn *net.TCPConn) error {
|
||||
if err := conn.SetKeepAliveConfig(net.KeepAliveConfig{
|
||||
Enable: true,
|
||||
Idle: DefaultKeepAliveIdle,
|
||||
Interval: DefaultKeepAliveInterval,
|
||||
Count: DefaultKeepAliveCount,
|
||||
}); err != nil {
|
||||
func setCommonSocketOptions(conn *net.TCPConn, keepAliveConfig net.KeepAliveConfig) error {
|
||||
if err := conn.SetKeepAliveConfig(keepAliveConfig); err != nil {
|
||||
return fmt.Errorf("cannot configure TCP keepalive: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user