Browse Source

ws: check for client_id value before checking for client (#1887)

master
Max Prokhorov 5 years ago
committed by GitHub
parent
commit
af18758073
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions
  1. +13
    -9
      code/espurna/ws.ino

+ 13
- 9
code/espurna/ws.ino View File

@ -642,17 +642,21 @@ void _wsHandleClientData(const bool connected) {
if (_ws_client_data.empty()) return;
auto& data = _ws_client_data.front();
AsyncWebSocketClient* ws_client = _ws.client(data.client_id);
if (!ws_client) {
_ws_client_data.pop();
return;
}
// client_id == 0 means we need to send the message to every client
if (data.client_id) {
AsyncWebSocketClient* ws_client = _ws.client(data.client_id);
// wait until we can send the next batch of messages
// XXX: enforce that callbacks send only one message per iteration
if (ws_client->queueIsFull()) {
return;
if (!ws_client) {
_ws_client_data.pop();
return;
}
// wait until we can send the next batch of messages
// XXX: enforce that callbacks send only one message per iteration
if (ws_client->queueIsFull()) {
return;
}
}
// XXX: block allocation will try to create *2 next time,


Loading…
Cancel
Save