From: Matt Joiner Date: Thu, 28 Aug 2014 00:06:57 +0000 (+1000) Subject: Disable TCP linger for peer connections X-Git-Tag: v1.0.0~1576 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=689fe85134038d4c15552826db326676eb1d5420;p=btrtrc.git Disable TCP linger for peer connections --- diff --git a/client.go b/client.go index 2dc4acfa..444fc176 100644 --- a/client.go +++ b/client.go @@ -495,6 +495,9 @@ func (pc peerConn) Read(b []byte) (n int, err error) { } func (me *Client) runConnection(sock net.Conn, torrent *torrent, discovery peerSource) (err error) { + if tcpConn, ok := sock.(*net.TCPConn); ok { + tcpConn.SetLinger(0) + } defer sock.Close() me.mu.Lock() me.handshaking++