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.
This commit is contained in:
Simon Ser 2020-06-04 16:58:31 +02:00
parent c709ebfc91
commit 77faf72fa3
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

13
conn.go
View File

@ -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,