Clear subscriptions before calling close handler, not after

This commit is contained in:
Alex Hultman
2021-11-13 09:23:09 +01:00
parent 01d16b3ce8
commit 9a5bc5d09c
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -195,14 +195,14 @@ public:
/* Set shorter timeout (use ping-timeout) to avoid long hanging sockets after end() on broken connections */
Super::timeout(webSocketContextData->idleTimeoutComponents.second);
/* Make sure to unsubscribe from any pub/sub node at exit */
webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
webSocketData->subscriber = nullptr;
/* Emit close event */
if (webSocketContextData->closeHandler) {
webSocketContextData->closeHandler(this, code, message);
}
/* Make sure to unsubscribe from any pub/sub node at exit */
webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
webSocketData->subscriber = nullptr;
}
/* Corks the response if possible. Leaves already corked socket be. */