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:
parent
c709ebfc91
commit
77faf72fa3
13
conn.go
13
conn.go
@ -9,17 +9,6 @@ import (
|
|||||||
"gopkg.in/irc.v3"
|
"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 {
|
type conn struct {
|
||||||
net net.Conn
|
net net.Conn
|
||||||
irc *irc.Conn
|
irc *irc.Conn
|
||||||
@ -32,8 +21,6 @@ type conn struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newConn(srv *Server, netConn net.Conn, logger Logger) *conn {
|
func newConn(srv *Server, netConn net.Conn, logger Logger) *conn {
|
||||||
setKeepAlive(netConn)
|
|
||||||
|
|
||||||
outgoing := make(chan *irc.Message, 64)
|
outgoing := make(chan *irc.Message, 64)
|
||||||
c := &conn{
|
c := &conn{
|
||||||
net: netConn,
|
net: netConn,
|
||||||
|
Loading…
Reference in New Issue
Block a user