mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
cluster/websocket: Raise websocket_client_lost() after terminate
Just in case events are created during backend->Terminate(). These should come before the Cluster::websocket_client_lost() event.
This commit is contained in:
parent
eb2eaee284
commit
63723cd9e3
1 changed files with 5 additions and 2 deletions
|
@ -342,11 +342,14 @@ void WebSocketEventDispatcher::Process(const WebSocketClose& close) {
|
||||||
|
|
||||||
// If the client doesn't have a backend, it wasn't ever properly instantiated.
|
// If the client doesn't have a backend, it wasn't ever properly instantiated.
|
||||||
if ( backend ) {
|
if ( backend ) {
|
||||||
|
backend->Terminate();
|
||||||
|
|
||||||
|
// Raise Cluster::websocket_client_lost() after the backend has terminated.
|
||||||
|
// In case any messages/events were still pending, Cluster::websocket_client_lost()
|
||||||
|
// should be the last event related to this WebSocket client.
|
||||||
auto rec = zeek::cluster::detail::bif::make_endpoint_info(backend->NodeId(), wsc->getRemoteIp(),
|
auto rec = zeek::cluster::detail::bif::make_endpoint_info(backend->NodeId(), wsc->getRemoteIp(),
|
||||||
wsc->getRemotePort(), TRANSPORT_TCP);
|
wsc->getRemotePort(), TRANSPORT_TCP);
|
||||||
zeek::event_mgr.Enqueue(Cluster::websocket_client_lost, std::move(rec));
|
zeek::event_mgr.Enqueue(Cluster::websocket_client_lost, std::move(rec));
|
||||||
|
|
||||||
backend->Terminate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clients.erase(it);
|
clients.erase(it);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue