(socket utility) move ix::getFreePort to ixwebsocket library

This commit is contained in:
Benjamin Sergeant
2020-07-27 18:17:13 -07:00
parent 5940e53d77
commit 4f41f209a2
10 changed files with 20 additions and 10 deletions

View File

@@ -19,11 +19,7 @@ namespace snake
public:
virtual ~SnakeConnectionState()
{
if (subscriptionThread.joinable())
{
subscriptionRedisClient.stop();
subscriptionThread.join();
}
stopSubScriptionThread();
}
std::string getNonce()
@@ -61,6 +57,15 @@ namespace snake
return _redisClient;
}
void stopSubScriptionThread()
{
if (subscriptionThread.joinable())
{
subscriptionRedisClient.stop();
subscriptionThread.join();
}
}
// We could make those accessible through methods
std::thread subscriptionThread;
std::string appChannel;

View File

@@ -261,7 +261,7 @@ namespace snake
auto body = pdu["body"];
auto subscriptionId = body["subscription_id"];
state->redisClient().stop();
state->stopSubScriptionThread();
nlohmann::json response = {{"action", "rtm/unsubscribe/ok"},
{"id", pduId},