Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ shutdown context error and initiates request cancellation and socket cleanup;
it does not wait indefinitely for custom handlers that ignore cancellation.
This change is not included in v1.0.1.

Source builds treat an entirely already-closed listener error as benign during
shutdown, including net/http's duplicate close of a stopped HTTP listener.
Mixed error chains retain unrelated close failures and context errors. A real
listener-close failure no longer skips tracked-connection cleanup: shutdown
still waits for the caller's deadline and closes remaining tracked connections
on expiry, reporting both failures. This is not included in v1.0.1.

Source builds also cancel pending SOCKS5 TCP CONNECT setup when its tracked
client connection is forcibly closed, without waiting for the full dial
timeout. Successful setup still cancels the temporary dialing context without
Expand Down
5 changes: 4 additions & 1 deletion internal/proxy/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,13 @@ func (s *HTTPServer) Serve(listener net.Listener) error {
// forcibly closed when ctx expires.
func (s *HTTPServer) Shutdown(ctx context.Context) error {
closeErr := s.lifecycle.stopAccepting()
if errors.Is(closeErr, net.ErrClosed) {
if isListenerClosedError(closeErr) {
closeErr = nil
}
httpErr := s.server.Shutdown(ctx)
if isListenerClosedError(httpErr) {
httpErr = nil
}
trackErr := s.lifecycle.shutdown(ctx)
s.transport.CloseIdleConnections()
return errors.Join(closeErr, httpErr, trackErr)
Expand Down
Loading
Loading