From 77faf72fa33a7549a314ea4c5945e5efd7a6cbcd Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 4 Jun 2020 16:58:31 +0200 Subject: [PATCH] Remove setKeepAlive Go sets a default keep-alive interval of 15 seconds on all TCP connections, if the platform supports it. See net.ListenConfig.KeepAlive and net.Dialer.KeepAlive. --- conn.go | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/conn.go b/conn.go index ab72d12..5f0c540 100644 --- a/conn.go +++ b/conn.go @@ -9,17 +9,6 @@ import ( "gopkg.in/irc.v3" ) -func setKeepAlive(c net.Conn) error { - tcpConn, ok := c.(*net.TCPConn) - if !ok { - return fmt.Errorf("cannot enable keep-alive on a non-TCP connection") - } - if err := tcpConn.SetKeepAlive(true); err != nil { - return err - } - return tcpConn.SetKeepAlivePeriod(keepAlivePeriod) -} - type conn struct { net net.Conn irc *irc.Conn @@ -32,8 +21,6 @@ type conn struct { } func newConn(srv *Server, netConn net.Conn, logger Logger) *conn { - setKeepAlive(netConn) - outgoing := make(chan *irc.Message, 64) c := &conn{ net: netConn,