mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
cluster/websocket: Leverage ReadyToPublishCallback()
Change WebSocket client handling to return only when the ready to publish callback has been invoked.
This commit is contained in:
parent
643b926625
commit
2cd2a2b8a6
2 changed files with 40 additions and 9 deletions
|
@ -145,7 +145,13 @@ struct WebSocketSubscribeFinished {
|
|||
std::string topic_prefix;
|
||||
};
|
||||
|
||||
using WebSocketEvent = std::variant<WebSocketOpen, WebSocketSubscribeFinished, WebSocketClose, WebSocketMessage>;
|
||||
// Internally created when the backend of a Websocket client is ready.
|
||||
struct WebSocketBackendReadyToPublish {
|
||||
std::string id;
|
||||
};
|
||||
|
||||
using WebSocketEvent = std::variant<WebSocketOpen, WebSocketSubscribeFinished, WebSocketClose, WebSocketMessage,
|
||||
WebSocketBackendReadyToPublish>;
|
||||
|
||||
struct WebSocketSendReply {
|
||||
std::shared_ptr<WebSocketClient> wsc;
|
||||
|
@ -211,6 +217,7 @@ private:
|
|||
|
||||
void Process(const WebSocketOpen& open);
|
||||
void Process(const WebSocketSubscribeFinished& fin);
|
||||
void Process(const WebSocketBackendReadyToPublish& ready);
|
||||
void Process(const WebSocketMessage& msg);
|
||||
void Process(const WebSocketClose& close);
|
||||
|
||||
|
@ -222,6 +229,7 @@ private:
|
|||
std::string id;
|
||||
std::shared_ptr<WebSocketClient> wsc;
|
||||
std::shared_ptr<zeek::cluster::Backend> backend;
|
||||
bool ready_to_publish = false;
|
||||
uint64_t msg_count = 0;
|
||||
std::list<WebSocketMessage> queue;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue