appease the linter some more

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
This commit is contained in:
Mohammed Al Sahaf 2025-03-25 23:19:42 +03:00
parent d3464efffd
commit e42cf4fc80
No known key found for this signature in database

View File

@ -136,7 +136,7 @@ func (fcl *fakeCloseListener) Accept() (net.Conn, error) {
}
// call underlying accept
conn, err := fcl.sharedListener.Accept()
conn, err := fcl.Accept()
if err == nil {
// if 0, do nothing, Go's default is already set
// and if the connection allows setting KeepAlive, set it
@ -147,7 +147,7 @@ func (fcl *fakeCloseListener) Accept() (net.Conn, error) {
err = tconn.SetKeepAlive(false)
}
if err != nil {
Log().With(zap.String("server", fcl.sharedListener.key)).Warn("unable to set keepalive for new connection:", zap.Error(err))
Log().With(zap.String("server", fcl.key)).Warn("unable to set keepalive for new connection:", zap.Error(err))
}
}
return conn, nil
@ -165,7 +165,7 @@ func (fcl *fakeCloseListener) Accept() (net.Conn, error) {
// users of this listener, not just our own reference to it; we also don't
// do anything with the error because all we could do is log it, but we
// explicitly assign it to nothing so we don't forget it's there if needed
_ = fcl.sharedListener.clearDeadline()
_ = fcl.clearDeadline()
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
return nil, fakeClosedErr(fcl)
@ -188,8 +188,8 @@ func (fcl *fakeCloseListener) Close() error {
// file). But we can set the deadline in the past,
// and this is kind of cheating, but it works, and
// it apparently even works on Windows.
_ = fcl.sharedListener.setDeadline()
_, _ = listenerPool.Delete(fcl.sharedListener.key)
_ = fcl.setDeadline()
_, _ = listenerPool.Delete(fcl.key)
}
return nil
}
@ -236,7 +236,7 @@ func (sl *sharedListener) setDeadline() error {
// Destruct is called by the UsagePool when the listener is
// finally not being used anymore. It closes the socket.
func (sl *sharedListener) Destruct() error {
return sl.Listener.Close()
return sl.Close()
}
// fakeClosePacketConn is like fakeCloseListener, but for PacketConns,
@ -279,13 +279,13 @@ func (fcpc *fakeClosePacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err e
func (fcpc *fakeClosePacketConn) Close() error {
if atomic.CompareAndSwapInt32(&fcpc.closed, 0, 1) {
_ = fcpc.SetReadDeadline(time.Now()) // unblock ReadFrom() calls to kick old servers out of their loops
_, _ = listenerPool.Delete(fcpc.sharedPacketConn.key)
_, _ = listenerPool.Delete(fcpc.key)
}
return nil
}
func (fcpc *fakeClosePacketConn) Unwrap() net.PacketConn {
return fcpc.sharedPacketConn.PacketConn
return fcpc.PacketConn
}
// sharedPacketConn is like sharedListener, but for net.PacketConns.
@ -296,7 +296,7 @@ type sharedPacketConn struct {
// Destruct closes the underlying socket.
func (spc *sharedPacketConn) Destruct() error {
return spc.PacketConn.Close()
return spc.Close()
}
// Unwrap returns the underlying socket