mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
cluster/websocket: Short-circuit clients without subscriptions
This commit is contained in:
parent
47206d6a8a
commit
23f0370e91
6 changed files with 82 additions and 0 deletions
|
@ -394,6 +394,14 @@ void WebSocketEventDispatcher::HandleSubscriptions(WebSocketClientEntry& entry,
|
|||
|
||||
entry.wsc->SetSubscriptions(subscriptions);
|
||||
|
||||
// Short-circuit setting up subscriptions and directly reply with
|
||||
// an ack if the client didn't request any topic subscriptions.
|
||||
if ( subscriptions.empty() ) {
|
||||
assert(entry.wsc->AllSubscriptionsActive());
|
||||
HandleSubscriptionsActive(entry);
|
||||
return;
|
||||
}
|
||||
|
||||
auto cb = [this, id = entry.id, wsc = entry.wsc](const std::string& topic,
|
||||
const Backend::SubscriptionCallbackInfo& info) {
|
||||
if ( info.status == Backend::CallbackStatus::Error ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue