rename _blocking to _backgroundThreadRunning and invert the naming
This commit is contained in:
		@@ -38,7 +38,7 @@ namespace ix
 | 
				
			|||||||
    WebSocket::WebSocket() :
 | 
					    WebSocket::WebSocket() :
 | 
				
			||||||
        _onMessageCallback(OnMessageCallback()),
 | 
					        _onMessageCallback(OnMessageCallback()),
 | 
				
			||||||
        _stop(false),
 | 
					        _stop(false),
 | 
				
			||||||
        _blocking(true),
 | 
					        _backgroundThreadRunning(false),
 | 
				
			||||||
        _automaticReconnection(true),
 | 
					        _automaticReconnection(true),
 | 
				
			||||||
        _handshakeTimeoutSecs(kDefaultHandShakeTimeoutSecs),
 | 
					        _handshakeTimeoutSecs(kDefaultHandShakeTimeoutSecs),
 | 
				
			||||||
        _enablePong(kDefaultEnablePong),
 | 
					        _enablePong(kDefaultEnablePong),
 | 
				
			||||||
@@ -136,7 +136,7 @@ namespace ix
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        if (_thread.joinable()) return; // we've already been started
 | 
					        if (_thread.joinable()) return; // we've already been started
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _blocking = false;
 | 
					        _backgroundThreadRunning = true;
 | 
				
			||||||
        _thread = std::thread(&WebSocket::run, this);
 | 
					        _thread = std::thread(&WebSocket::run, this);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -157,8 +157,8 @@ namespace ix
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        _stop = true;
 | 
					        _stop = true;
 | 
				
			||||||
        _thread.join();
 | 
					        _thread.join();
 | 
				
			||||||
 | 
					        _backgroundThreadRunning = false;
 | 
				
			||||||
        _stop = false;
 | 
					        _stop = false;
 | 
				
			||||||
        _blocking = true;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _automaticReconnection = automaticReconnection;
 | 
					        _automaticReconnection = automaticReconnection;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -321,7 +321,7 @@ namespace ix
 | 
				
			|||||||
            //    an explicit disconnection from the callback, or by the remote end
 | 
					            //    an explicit disconnection from the callback, or by the remote end
 | 
				
			||||||
            //    closing the connection, ie isConnected() == false.
 | 
					            //    closing the connection, ie isConnected() == false.
 | 
				
			||||||
            //    closing the connection, ie isConnectedOrClosing() == false.
 | 
					            //    closing the connection, ie isConnectedOrClosing() == false.
 | 
				
			||||||
            if (_blocking && !isConnectedOrClosing() && !_automaticReconnection) return;
 | 
					            if (!_backgroundThreadRunning && !isConnected() && !_automaticReconnection) return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -154,7 +154,7 @@ namespace ix
 | 
				
			|||||||
        static OnTrafficTrackerCallback _onTrafficTrackerCallback;
 | 
					        static OnTrafficTrackerCallback _onTrafficTrackerCallback;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::atomic<bool> _stop;
 | 
					        std::atomic<bool> _stop;
 | 
				
			||||||
        std::atomic<bool> _blocking;
 | 
					        std::atomic<bool> _backgroundThreadRunning;
 | 
				
			||||||
        std::atomic<bool> _automaticReconnection;
 | 
					        std::atomic<bool> _automaticReconnection;
 | 
				
			||||||
        std::thread _thread;
 | 
					        std::thread _thread;
 | 
				
			||||||
        std::mutex _writeMutex;
 | 
					        std::mutex _writeMutex;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user