(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

@ -30,6 +30,7 @@ set( IXWEBSOCKET_SOURCES
ixwebsocket/IXConnectionState.cpp ixwebsocket/IXConnectionState.cpp
ixwebsocket/IXDNSLookup.cpp ixwebsocket/IXDNSLookup.cpp
ixwebsocket/IXExponentialBackoff.cpp ixwebsocket/IXExponentialBackoff.cpp
ixwebsocket/IXGetFreePort.cpp
ixwebsocket/IXHttp.cpp ixwebsocket/IXHttp.cpp
ixwebsocket/IXHttpClient.cpp ixwebsocket/IXHttpClient.cpp
ixwebsocket/IXHttpServer.cpp ixwebsocket/IXHttpServer.cpp
@ -65,6 +66,7 @@ set( IXWEBSOCKET_HEADERS
ixwebsocket/IXConnectionState.h ixwebsocket/IXConnectionState.h
ixwebsocket/IXDNSLookup.h ixwebsocket/IXDNSLookup.h
ixwebsocket/IXExponentialBackoff.h ixwebsocket/IXExponentialBackoff.h
ixwebsocket/IXGetFreePort.h
ixwebsocket/IXHttp.h ixwebsocket/IXHttp.h
ixwebsocket/IXHttpClient.h ixwebsocket/IXHttpClient.h
ixwebsocket/IXHttpServer.h ixwebsocket/IXHttpServer.h

View File

@ -1,6 +1,10 @@
# Changelog # Changelog
All changes to this project will be documented in this file. All changes to this project will be documented in this file.
## [10.0.1] - 2020-07-27
(socket utility) move ix::getFreePort to ixwebsocket library
## [10.0.0] - 2020-07-25 ## [10.0.0] - 2020-07-25
(ixwebsocket server) change legacy api with 2 nested callbacks, so that the first api takes a weak_ptr<WebSocket> as its first argument (ixwebsocket server) change legacy api with 2 nested callbacks, so that the first api takes a weak_ptr<WebSocket> as its first argument

View File

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

View File

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

View File

@ -6,4 +6,4 @@
#pragma once #pragma once
#define IX_WEBSOCKET_VERSION "10.0.0" #define IX_WEBSOCKET_VERSION "10.0.1"

View File

@ -37,7 +37,6 @@ set (SOURCES
test_runner.cpp test_runner.cpp
IXTest.cpp IXTest.cpp
IXGetFreePort.cpp
../third_party/msgpack11/msgpack11.cpp ../third_party/msgpack11/msgpack11.cpp
IXSocketTest.cpp IXSocketTest.cpp

View File

@ -4,9 +4,9 @@
* Copyright (c) 2019 Machine Zone. All rights reserved. * Copyright (c) 2019 Machine Zone. All rights reserved.
*/ */
#include "IXGetFreePort.h"
#include "catch.hpp" #include "catch.hpp"
#include <iostream> #include <iostream>
#include <ixwebsocket/IXGetFreePort.h>
#include <ixwebsocket/IXHttpClient.h> #include <ixwebsocket/IXHttpClient.h>
#include <ixwebsocket/IXHttpServer.h> #include <ixwebsocket/IXHttpServer.h>

View File

@ -6,9 +6,9 @@
#pragma once #pragma once
#include "IXGetFreePort.h"
#include <iostream> #include <iostream>
#include <ixsnake/IXAppConfig.h> #include <ixsnake/IXAppConfig.h>
#include <ixwebsocket/IXGetFreePort.h>
#include <ixwebsocket/IXSocketTLSOptions.h> #include <ixwebsocket/IXSocketTLSOptions.h>
#include <ixwebsocket/IXWebSocketServer.h> #include <ixwebsocket/IXWebSocketServer.h>
#include <mutex> #include <mutex>