From 14ec8522ef88fe9b02e4711aa4be3a5b20397441 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Wed, 1 May 2019 11:08:36 -0700 Subject: [PATCH] remove un-needed _backgroundThreadRunning variable --- ixwebsocket/IXWebSocket.cpp | 7 +------ ixwebsocket/IXWebSocket.h | 1 - ixwebsocket/IXWebSocketTransport.cpp | 2 +- ws/ws_redis_publish.cpp | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/ixwebsocket/IXWebSocket.cpp b/ixwebsocket/IXWebSocket.cpp index a7e581ce..9e1ab740 100644 --- a/ixwebsocket/IXWebSocket.cpp +++ b/ixwebsocket/IXWebSocket.cpp @@ -38,7 +38,6 @@ namespace ix WebSocket::WebSocket() : _onMessageCallback(OnMessageCallback()), _stop(false), - _backgroundThreadRunning(false), _automaticReconnection(true), _handshakeTimeoutSecs(kDefaultHandShakeTimeoutSecs), _enablePong(kDefaultEnablePong), @@ -136,7 +135,6 @@ namespace ix { if (_thread.joinable()) return; // we've already been started - _backgroundThreadRunning = true; _thread = std::thread(&WebSocket::run, this); } @@ -157,7 +155,6 @@ namespace ix _stop = true; _thread.join(); - _backgroundThreadRunning = false; _stop = false; _automaticReconnection = automaticReconnection; @@ -343,9 +340,7 @@ namespace ix WebSocket::invokeTrafficTrackerCallback(msg.size(), true); }); - // 4. In blocking mode, getting out of this function is triggered by - // an explicit disconnection from the callback, or by the remote end - // closing the connection, ie isConnected() == false. + // If we aren't trying to reconnect automatically, exit if we aren't connected if (!isConnected() && !_automaticReconnection) return; } } diff --git a/ixwebsocket/IXWebSocket.h b/ixwebsocket/IXWebSocket.h index d825a2d0..8c6bf702 100644 --- a/ixwebsocket/IXWebSocket.h +++ b/ixwebsocket/IXWebSocket.h @@ -154,7 +154,6 @@ namespace ix static OnTrafficTrackerCallback _onTrafficTrackerCallback; std::atomic _stop; - std::atomic _backgroundThreadRunning; std::atomic _automaticReconnection; std::thread _thread; std::mutex _writeMutex; diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp index bb3c083e..455702d6 100644 --- a/ixwebsocket/IXWebSocketTransport.cpp +++ b/ixwebsocket/IXWebSocketTransport.cpp @@ -553,7 +553,7 @@ namespace ix // Get the reason. std::string reason(_rxbuf.begin()+ws.header_size + 2, _rxbuf.begin()+ws.header_size + (size_t) ws.N); - + bool remote = true; close(code, reason, _rxbuf.size(), remote); diff --git a/ws/ws_redis_publish.cpp b/ws/ws_redis_publish.cpp index c5c4139b..b236fc2a 100644 --- a/ws/ws_redis_publish.cpp +++ b/ws/ws_redis_publish.cpp @@ -41,7 +41,7 @@ namespace ix { if (!redisClient.publish(channel, message, errMsg)) { - std::cerr << "Error publishing to channel " << channel + std::cerr << "Error publishing to channel " << channel << "error: " << errMsg << std::endl; return 1;