From 916ca45a5b6b948a351d2144a0fbf44e67f05f57 Mon Sep 17 00:00:00 2001 From: Gene Date: Thu, 11 Jan 2024 16:10:37 +0100 Subject: [PATCH] - fix response callback de-allocation - do not queue (drop) event messages when not connected --- src/net/NetManager.h | 1 + src/service/EventRouter.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/net/NetManager.h b/src/net/NetManager.h index 0a38587..a1ca27d 100644 --- a/src/net/NetManager.h +++ b/src/net/NetManager.h @@ -162,6 +162,7 @@ namespace Net { if (!netRequestHandler->onNetRequest(&server, requestUri.c_str(), responseCallback)) { responseCallback->error("Invalid request."); }; + delete responseCallback; return true; } diff --git a/src/service/EventRouter.cpp b/src/service/EventRouter.cpp index 7b7a566..abe8338 100644 --- a/src/service/EventRouter.cpp +++ b/src/service/EventRouter.cpp @@ -88,9 +88,9 @@ namespace Service { } void EventRouter::signalEvent(QueuedMessage m) { -// if (WiFi.isConnected()) { - eventsQueue.add(m); -// } + if (WiFi.isConnected()) { + eventsQueue.add(m); + } } void EventRouter::withNetManager(NetManager &manager) {