Merge branch 'master' into add-close-code-to-websocket-and-fixes

This commit is contained in:
Alexandre Konieczny 2019-04-24 18:49:00 +02:00
commit f9abf3908f
4 changed files with 12 additions and 2 deletions

View File

@ -135,6 +135,11 @@ namespace ix
_conditionVariable.wait(lock);
}
void SocketServer::stopAcceptingConnections()
{
_stop = true;
}
void SocketServer::stop()
{
while (true)
@ -270,6 +275,8 @@ namespace ix
connectionState = _connectionStateFactory();
}
if (_stop) return;
// Launch the handleConnection work asynchronously in its own thread.
_connectionsThreads.push_back(std::make_pair(
connectionState,

View File

@ -57,6 +57,8 @@ namespace ix
void logError(const std::string& str);
void logInfo(const std::string& str);
void stopAcceptingConnections();
private:
// Member variables
int _port;

View File

@ -37,6 +37,8 @@ namespace ix
void WebSocketServer::stop()
{
stopAcceptingConnections();
auto clients = getClients();
for (auto client : clients)
{

View File

@ -122,7 +122,6 @@ namespace snake
void handlePublish(
std::shared_ptr<SnakeConnectionState> state,
std::shared_ptr<ix::WebSocket> ws,
const AppConfig& appConfig,
const nlohmann::json& pdu)
{
std::vector<std::string> channels;
@ -293,7 +292,7 @@ namespace snake
}
else if (action == "rtm/publish")
{
handlePublish(state, ws, appConfig, pdu);
handlePublish(state, ws, pdu);
}
else if (action == "rtm/subscribe")
{