Skip to content

Commit 4f41f20

Browse files
committed
(socket utility) move ix::getFreePort to ixwebsocket library
1 parent 5940e53 commit 4f41f20

File tree

10 files changed

+20
-10
lines changed

10 files changed

+20
-10
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ set( IXWEBSOCKET_SOURCES
3030
ixwebsocket/IXConnectionState.cpp
3131
ixwebsocket/IXDNSLookup.cpp
3232
ixwebsocket/IXExponentialBackoff.cpp
33+
ixwebsocket/IXGetFreePort.cpp
3334
ixwebsocket/IXHttp.cpp
3435
ixwebsocket/IXHttpClient.cpp
3536
ixwebsocket/IXHttpServer.cpp
@@ -65,6 +66,7 @@ set( IXWEBSOCKET_HEADERS
6566
ixwebsocket/IXConnectionState.h
6667
ixwebsocket/IXDNSLookup.h
6768
ixwebsocket/IXExponentialBackoff.h
69+
ixwebsocket/IXGetFreePort.h
6870
ixwebsocket/IXHttp.h
6971
ixwebsocket/IXHttpClient.h
7072
ixwebsocket/IXHttpServer.h

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [10.0.1] - 2020-07-27
5+
6+
(socket utility) move ix::getFreePort to ixwebsocket library
7+
48
## [10.0.0] - 2020-07-25
59

610
(ixwebsocket server) change legacy api with 2 nested callbacks, so that the first api takes a weak_ptr<WebSocket> as its first argument

ixsnake/ixsnake/IXSnakeConnectionState.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ namespace snake
1919
public:
2020
virtual ~SnakeConnectionState()
2121
{
22-
if (subscriptionThread.joinable())
23-
{
24-
subscriptionRedisClient.stop();
25-
subscriptionThread.join();
26-
}
22+
stopSubScriptionThread();
2723
}
2824

2925
std::string getNonce()
@@ -61,6 +57,15 @@ namespace snake
6157
return _redisClient;
6258
}
6359

60+
void stopSubScriptionThread()
61+
{
62+
if (subscriptionThread.joinable())
63+
{
64+
subscriptionRedisClient.stop();
65+
subscriptionThread.join();
66+
}
67+
}
68+
6469
// We could make those accessible through methods
6570
std::thread subscriptionThread;
6671
std::string appChannel;

ixsnake/ixsnake/IXSnakeProtocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ namespace snake
261261
auto body = pdu["body"];
262262
auto subscriptionId = body["subscription_id"];
263263

264-
state->redisClient().stop();
264+
state->stopSubScriptionThread();
265265

266266
nlohmann::json response = {{"action", "rtm/unsubscribe/ok"},
267267
{"id", pduId},
File renamed without changes.
File renamed without changes.

ixwebsocket/IXWebSocketVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
#pragma once
88

9-
#define IX_WEBSOCKET_VERSION "10.0.0"
9+
#define IX_WEBSOCKET_VERSION "10.0.1"

test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ set (SOURCES
3737

3838
test_runner.cpp
3939
IXTest.cpp
40-
IXGetFreePort.cpp
4140
../third_party/msgpack11/msgpack11.cpp
4241

4342
IXSocketTest.cpp

test/IXHttpServerTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Copyright (c) 2019 Machine Zone. All rights reserved.
55
*/
66

7-
#include "IXGetFreePort.h"
87
#include "catch.hpp"
98
#include <iostream>
9+
#include <ixwebsocket/IXGetFreePort.h>
1010
#include <ixwebsocket/IXHttpClient.h>
1111
#include <ixwebsocket/IXHttpServer.h>
1212

test/IXTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#pragma once
88

9-
#include "IXGetFreePort.h"
109
#include <iostream>
1110
#include <ixsnake/IXAppConfig.h>
11+
#include <ixwebsocket/IXGetFreePort.h>
1212
#include <ixwebsocket/IXSocketTLSOptions.h>
1313
#include <ixwebsocket/IXWebSocketServer.h>
1414
#include <mutex>

0 commit comments

Comments
 (0)