remove un-needed _backgroundThreadRunning variable
This commit is contained in:
parent
0c2d1c22bc
commit
14ec8522ef
@ -38,7 +38,6 @@ namespace ix
|
|||||||
WebSocket::WebSocket() :
|
WebSocket::WebSocket() :
|
||||||
_onMessageCallback(OnMessageCallback()),
|
_onMessageCallback(OnMessageCallback()),
|
||||||
_stop(false),
|
_stop(false),
|
||||||
_backgroundThreadRunning(false),
|
|
||||||
_automaticReconnection(true),
|
_automaticReconnection(true),
|
||||||
_handshakeTimeoutSecs(kDefaultHandShakeTimeoutSecs),
|
_handshakeTimeoutSecs(kDefaultHandShakeTimeoutSecs),
|
||||||
_enablePong(kDefaultEnablePong),
|
_enablePong(kDefaultEnablePong),
|
||||||
@ -136,7 +135,6 @@ namespace ix
|
|||||||
{
|
{
|
||||||
if (_thread.joinable()) return; // we've already been started
|
if (_thread.joinable()) return; // we've already been started
|
||||||
|
|
||||||
_backgroundThreadRunning = true;
|
|
||||||
_thread = std::thread(&WebSocket::run, this);
|
_thread = std::thread(&WebSocket::run, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +155,6 @@ namespace ix
|
|||||||
|
|
||||||
_stop = true;
|
_stop = true;
|
||||||
_thread.join();
|
_thread.join();
|
||||||
_backgroundThreadRunning = false;
|
|
||||||
_stop = false;
|
_stop = false;
|
||||||
|
|
||||||
_automaticReconnection = automaticReconnection;
|
_automaticReconnection = automaticReconnection;
|
||||||
@ -343,9 +340,7 @@ namespace ix
|
|||||||
WebSocket::invokeTrafficTrackerCallback(msg.size(), true);
|
WebSocket::invokeTrafficTrackerCallback(msg.size(), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 4. In blocking mode, getting out of this function is triggered by
|
// If we aren't trying to reconnect automatically, exit if we aren't connected
|
||||||
// an explicit disconnection from the callback, or by the remote end
|
|
||||||
// closing the connection, ie isConnected() == false.
|
|
||||||
if (!isConnected() && !_automaticReconnection) return;
|
if (!isConnected() && !_automaticReconnection) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,6 @@ namespace ix
|
|||||||
static OnTrafficTrackerCallback _onTrafficTrackerCallback;
|
static OnTrafficTrackerCallback _onTrafficTrackerCallback;
|
||||||
|
|
||||||
std::atomic<bool> _stop;
|
std::atomic<bool> _stop;
|
||||||
std::atomic<bool> _backgroundThreadRunning;
|
|
||||||
std::atomic<bool> _automaticReconnection;
|
std::atomic<bool> _automaticReconnection;
|
||||||
std::thread _thread;
|
std::thread _thread;
|
||||||
std::mutex _writeMutex;
|
std::mutex _writeMutex;
|
||||||
|
@ -553,7 +553,7 @@ namespace ix
|
|||||||
// Get the reason.
|
// Get the reason.
|
||||||
std::string reason(_rxbuf.begin()+ws.header_size + 2,
|
std::string reason(_rxbuf.begin()+ws.header_size + 2,
|
||||||
_rxbuf.begin()+ws.header_size + (size_t) ws.N);
|
_rxbuf.begin()+ws.header_size + (size_t) ws.N);
|
||||||
|
|
||||||
bool remote = true;
|
bool remote = true;
|
||||||
|
|
||||||
close(code, reason, _rxbuf.size(), remote);
|
close(code, reason, _rxbuf.size(), remote);
|
||||||
|
@ -41,7 +41,7 @@ namespace ix
|
|||||||
{
|
{
|
||||||
if (!redisClient.publish(channel, message, errMsg))
|
if (!redisClient.publish(channel, message, errMsg))
|
||||||
{
|
{
|
||||||
std::cerr << "Error publishing to channel " << channel
|
std::cerr << "Error publishing to channel " << channel
|
||||||
<< "error: " << errMsg
|
<< "error: " << errMsg
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user