That's definitely not correct either

This commit is contained in:
Alex Hultman
2021-09-26 20:33:41 +02:00
parent 5e1d1f1388
commit a924404bed
+3 -3
View File
@@ -224,7 +224,8 @@ public:
/* If we don't have a TopicTree yet, create one now */
if (!topicTree) {
topicTree = new TopicTree<TopicTreeMessage>([](Subscriber *s, TopicTreeMessage &message, TopicTree<TopicTreeMessage>::IteratorFlags flags) {
bool needsUncork = false;
topicTree = new TopicTree<TopicTreeMessage>([needsUncork](Subscriber *s, TopicTreeMessage &message, TopicTree<TopicTreeMessage>::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<SSL, true, int> *) s->user;
/* If this is the first message we try and cork */
bool needsUncork = false;
if (flags & TopicTree<TopicTreeMessage>::IteratorFlags::FIRST) {
if (ws->canCork() && !ws->isCorked()) {
((AsyncSocket<SSL> *)ws)->cork();
@@ -242,9 +242,9 @@ public:
/* If we ever overstep maxBackpresure, exit immediately */
if (WebSocket<SSL, true, int>::SendStatus::DROPPED == ws->send(message.message, (OpCode)message.opCode, message.compress)) {
if (needsUncork) {
((AsyncSocket<SSL> *)ws)->uncork();
needsUncork = false;
}
/* Stop draining */
return true;