File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments