Skip to content

Commit

Permalink
Change linger timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
v-byte-cpu committed Apr 4, 2021
1 parent 5cb90da commit 376830b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/scan/socks5/socks5.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ func (s *Scanner) Scan(ctx context.Context, r *scan.Request) (result scan.Result
return
}
defer conn.Close()
// tell the operating system to discard any unsent or unacknowledged data on Close()
// it will release all socket resources and send RST packet, fine for the scan
if err = conn.(*net.TCPConn).SetLinger(0); err != nil {
// tell the operating system to discard any unsent or unacknowledged data on Close(),
// after a maximum of 1 second it will release all socket resources and send RST packet,
// fine for the scan
if err = conn.(*net.TCPConn).SetLinger(1); err != nil {
return
}

Expand Down

0 comments on commit 376830b

Please sign in to comment.