Skip to content

Commit

Permalink
do not block accepting connections
Browse files Browse the repository at this point in the history
When using a plain TCP listener, goScanConnection creates some data
structures and moves on to scan which is wrapped in a goroutine.

When using a TLS listener, goScanConnection does not return until the
TLS handshake is complete. A lot can go wrong during this stage.

This change wraps goScanConnection in a goroutine to avoid blocking
accepting the next connection.
  • Loading branch information
munkyboy committed Oct 26, 2021
1 parent 307370c commit 2ee09f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (s *Server) goAcceptConnection(listener net.Listener) {
continue
}

s.goScanConnection(connection)
go s.goScanConnection(connection)
}

s.wait.Done()
Expand Down

0 comments on commit 2ee09f4

Please sign in to comment.