Skip to content

Commit ee2bc65

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 6adae66 commit ee2bc65

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
@@ -198,7 +198,7 @@ func (s *Server) goAcceptConnection(listener net.Listener) {
198198
continue
199199
}
200200

201-
s.goScanConnection(connection)
201+
go s.goScanConnection(connection)
202202
}
203203

204204
s.wait.Done()

0 commit comments

Comments
 (0)