Skip to content

Commit 8428e7c

Browse files
committed
Update SetLinger comment
1 parent bf10090 commit 8428e7c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/scan/socks5/socks5.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ func (s *Scanner) Scan(ctx context.Context, r *scan.Request) (result scan.Result
7777
return
7878
}
7979
defer conn.Close()
80-
// tell the operating system to discard any unsent or unacknowledged data on Close(),
81-
// after a maximum of 1 second it will release all socket resources and send RST packet,
82-
// fine for the scan
80+
// wait a maximum of 1 second for normal confirmation of connection termination ( FIN,ACK )
81+
// on Close() instead of default net.ipv4.tcp_fin_timeout = 60 seconds;
82+
// if this time has elapsed, the operating system will discard any unsent or unacknowledged
83+
// data, send RST packet and release all socket resources, fine for the scan;
84+
// note that in normal case ( FIN,ACK received ) the socket goes to the TIME-WAIT state anyway,
85+
// it limits the maximum number of open outbound network connections
86+
// so setting net.ipv4.tcp_tw_reuse to 1 is useful
8387
if err = conn.(*net.TCPConn).SetLinger(1); err != nil {
8488
return
8589
}

0 commit comments

Comments
 (0)