From b100d5f60385a3a2af288a6958b31bd8edcbd414 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Fri, 16 Aug 2019 02:09:06 +0300 Subject: [PATCH] ws: create incoming buffer once, no need to delay --- code/espurna/ws.ino | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/espurna/ws.ino b/code/espurna/ws.ino index d1fa27b3..fc3faa07 100644 --- a/code/espurna/ws.ino +++ b/code/espurna/ws.ino @@ -604,6 +604,7 @@ void _wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTy _wsConnected(client->id()); _wsResetUpdateTimer(); wifiReconnectCheck(); + client->_tempObject = new WebSocketIncommingBuffer(_wsParse, true); } else if(type == WS_EVT_DISCONNECT) { DEBUG_MSG_P(PSTR("[WEBSOCKET] #%u disconnected\n"), client->id()); @@ -670,9 +671,7 @@ void _wsHandleClientData(const bool connected) { yield(); if (data.done()) { - // push the queue and finally allow incoming messages _ws_client_data.pop(); - ws_client->_tempObject = new WebSocketIncommingBuffer(_wsParse, true); } }