From a924404bed081bdfa94df54c79395285ca83644c Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Sun, 26 Sep 2021 20:33:41 +0200 Subject: [PATCH] That's definitely not correct either --- src/App.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App.h b/src/App.h index 32fb084..1cb5b5d 100644 --- a/src/App.h +++ b/src/App.h @@ -224,7 +224,8 @@ public: /* If we don't have a TopicTree yet, create one now */ if (!topicTree) { - topicTree = new TopicTree([](Subscriber *s, TopicTreeMessage &message, TopicTree::IteratorFlags flags) { + bool needsUncork = false; + topicTree = new TopicTree([needsUncork](Subscriber *s, TopicTreeMessage &message, TopicTree::IteratorFlags flags) mutable { /* Subscriber's user is the socket */ /* Unfortunately we need to cast is to PerSocketData = int * since many different WebSocketContexts use the same @@ -232,7 +233,6 @@ public: auto *ws = (WebSocket *) s->user; /* If this is the first message we try and cork */ - bool needsUncork = false; if (flags & TopicTree::IteratorFlags::FIRST) { if (ws->canCork() && !ws->isCorked()) { ((AsyncSocket *)ws)->cork(); @@ -242,9 +242,9 @@ public: /* If we ever overstep maxBackpresure, exit immediately */ if (WebSocket::SendStatus::DROPPED == ws->send(message.message, (OpCode)message.opCode, message.compress)) { - if (needsUncork) { ((AsyncSocket *)ws)->uncork(); + needsUncork = false; } /* Stop draining */ return true;