Fix socket reuse in HTTP server accept loop
bmcweb HTTP server accept handling had a critical bug where a single socket pointer was reused across multiple acceptors, causing undefined behavior and potential crashes. 1. Move socket creation into doAcceptOne() to ensure each acceptor creates its own unique socket instance. 2. Pass acceptor pointer to afterAccept() callback to track which acceptor completed the accept operation. 3. Replace doAccept() call with doAcceptOne() in afterAccept() to resume accepting on only the specific acceptor that handled the connection, not all acceptors. This ensures proper socket lifecycle management and prevents race conditions from shared socket instances. Tested: HTTP server accepts connections correctly with multiple acceptors (HTTP/HTTPS) without crashes or undefined behavior. Change-Id: I0540802cdd682e8e7d7312d6edfd5651bf09378a Signed-off-by: Kokilambal Varadhan <kokilavaradhan@gmail.com>
K
Kokilambal Varadhan committed
661dc12c540e94033a43a1a5955bbf8aaeb2889b
Parent: 11183b1
Committed by Ed Tanous <ed@tanous.net>
on 6/24/2026, 10:41:58 PM