mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-09 04:43:48 +00:00
When max_missed_pongs was exceeded, the heartbeat thread called close(), which returns without touching the socket while another thread is in read(). That read() then stayed blocked until its read timeout: forever by default on a client, 300 seconds on a server. A plain read loop never noticed the unresponsive peer the heartbeat had just detected. Shut down the read side of the socket after close() so the pending read() returns Fail. Only the read side: a TLS backend answers the EOF with an alert, and writing it to a socket closed for writing raises SIGPIPE in a process that has not ignored it. ClientDetectsNonResponsivePeer now waits in read() instead of polling is_open(), which covers both.