]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Disable TCP linger for peer connections
authorMatt Joiner <anacrolix@gmail.com>
Thu, 28 Aug 2014 00:06:57 +0000 (10:06 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 28 Aug 2014 00:06:57 +0000 (10:06 +1000)
client.go

index 2dc4acfa4b624e78aa8b6b8d4594867af3480756..444fc176257c731a0790bab3d8050a345377df66 100644 (file)
--- 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++