Commit 08df914b authored by Joakim L. Gilje's avatar Joakim L. Gilje Committed by Alex Hultman

clear pollQueue onEnd (#556)

* clear pollQueue onEnd

* delete the ending httpSocket from the pollQueue, don't clear the queue

* lock/unlock mutex while updating changePollQueue

* remove all instances of the ending httpSocket

* add clearPendingPollChanges in NodeData, call from both HttpSocket and WebSocket
parent d83604d5
......@@ -296,6 +296,8 @@ void HttpSocket<isServer>::onEnd(uS::Socket *s) {
delete httpSocket->preAllocatedResponse;
}
httpSocket->nodeData->clearPendingPollChanges(httpSocket);
if (!isServer) {
httpSocket->cancelTimeout();
Group<CLIENT>::from(httpSocket)->errorHandler(httpSocket->httpUser);
......
......@@ -243,6 +243,15 @@ public:
async->setData(this);
async->start(NodeData::asyncCallback);
}
void clearPendingPollChanges(Poll *p) {
asyncMutex->lock();
changePollQueue.erase(
std::remove(changePollQueue.begin(), changePollQueue.end(), p),
changePollQueue.end()
);
asyncMutex->unlock();
}
};
}
......
......@@ -288,6 +288,8 @@ void WebSocket<isServer>::onEnd(uS::Socket *s) {
}
webSocket->messageQueue.pop();
}
webSocket->nodeData->clearPendingPollChanges(webSocket);
}
template <bool isServer>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment