2
0
mirror of synced 2025-02-24 06:38:14 +00:00

Disable TCP linger for peer connections

This commit is contained in:
Matt Joiner 2014-08-28 10:06:57 +10:00
parent ed08bd2837
commit 689fe85134

View File

@ -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) { 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() defer sock.Close()
me.mu.Lock() me.mu.Lock()
me.handshaking++ me.handshaking++