Files
cpp-httplib/test
yhirose 92435b31b3 Let Server::stop() end a WebSocket handler's read() (#2682)
stop() takes the listening socket away, and listen() then waits for every
handler to return. A WebSocket handler waiting in read() on a client that
stays connected never learned of the stop: with no read timeout it waited
for the 300 s backstop, and with one it got Timeout back on an open
connection, so a `while (ws.read(msg) != Fail)` loop went on forever and
listen() with it.

The server now hands each WebSocket a predicate for its own stop, and the
WebSocket's read interrupt answers to it as it does to a pong timeout. A
read cut short while the server stops, between messages or in the middle
of a fragmented one, sends a Close with 1001 Going Away and returns Fail.
That close does not wait for the peer's reply, so a stop is not held up
per connection.

A server WebSocket's reads now wait in the interruptible slices whatever
the heartbeat settings, as keep-alive connections already do for the same
check.
2026-11-18 07:56:00 -05:00
..
2021-09-11 14:26:48 -04:00
2021-09-11 14:26:48 -04:00
2017-12-29 22:34:59 -05:00
2013-07-04 18:18:52 -04:00
2024-11-16 11:14:13 -05:00