Skip to content

Commit 2ee09f4

Browse files
committed
do not block accepting connections
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.
1 parent 307370c commit 2ee09f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (s *Server) goAcceptConnection(listener net.Listener) {
184184
continue
185185
}
186186

187-
s.goScanConnection(connection)
187+
go s.goScanConnection(connection)
188188
}
189189

190190
s.wait.Done()

0 commit comments

Comments
 (0)