mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
cluster/websocket: Stop and wait for reply thread during Terminate()
The terminate-while-queueing test added for #4428 failed spuriously indicating that sometimes WebSocket clients receive code 1000 instead of 1001. This happens if the ixwebsocket server is shutdown before the reply thread had a chance to process queued close messages. Fix by signaling and waiting for the dispatcher's reply thread to terminate before returning from Terminate().
This commit is contained in:
parent
ac1230fcbe
commit
ca02316671
2 changed files with 6 additions and 1 deletions
|
@ -249,6 +249,11 @@ void WebSocketEventDispatcher::Terminate() {
|
|||
clients.clear();
|
||||
|
||||
onloop->Close();
|
||||
|
||||
// Wait for the reply_msg_thread to process any outstanding
|
||||
// WebSocketReply messages before returning.
|
||||
reply_msg_thread->SignalStop();
|
||||
reply_msg_thread->WaitForStop();
|
||||
}
|
||||
|
||||
void WebSocketEventDispatcher::QueueForProcessing(WebSocketEvent&& event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue