mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-17 19:30:54 +00:00
Bound the wait of WebSocket::close() as a whole
close() waited for the peer's Close reply with a read timeout that applied to each read, so a peer that kept sending other frames, or sent one frame a byte at a time, held close() for as long as it liked. Bound the wait as a whole. close() sets the stream's max timeout, which shortens each wait to what is left, and stops reading frames at the deadline, which matters when the peer keeps the socket full and no wait happens at all. WebSocketSSLStream gains set_max_timeout(), the one stream a WebSocket uses that lacked it. A read() running on another thread when close() is called still waits for the reply up to its own read timeout, as documented. The docs now say how to bound it.
This commit is contained in:
1 parent
d7b0d4bedb
commit
36065c657c
6 files changed
+177
-17
No files matched your search
+1
-1
@@ -260,7 +260,7 @@ endif
|
||||
test_benchmark : test_benchmark.cc ../httplib.h Makefile
|
||||
$(CXX) -o $@ -I.. $(CXXFLAGS) test_benchmark.cc gtest/src/gtest-all.cc gtest/src/gtest_main.cc -Igtest -Igtest/include $(BENCHMARK_LIBS)
|
||||
|
||||
test_websocket_heartbeat : test_websocket_heartbeat.cc ../httplib.h Makefile
|
||||
test_websocket_heartbeat : test_websocket_heartbeat.cc ../httplib.h Makefile cert.pem
|
||||
$(CXX) -o $@ -I.. $(CXXFLAGS) test_websocket_heartbeat.cc $(TEST_ARGS)
|
||||
@file $@
|
||||
|
||||
|
||||
Reference in new issue
Block a user