cleanup
This commit is contained in:
parent
225aade89d
commit
bbf34aef29
@ -230,11 +230,11 @@ namespace ix
|
||||
millis duration;
|
||||
|
||||
// Try to connect only once when we don't have automaticReconnection setup
|
||||
if (!isConnected() && !_automaticReconnection && !_stop)
|
||||
if (!isConnected() && !isClosing() && !_stop && !_automaticReconnection)
|
||||
{
|
||||
status = connect(_handshakeTimeoutSecs);
|
||||
|
||||
if (!status.success && !_stop)
|
||||
if (!status.success)
|
||||
{
|
||||
duration = millis(calculateRetryWaitMilliseconds(retries++));
|
||||
|
||||
@ -249,6 +249,7 @@ namespace ix
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise try to reconnect perpertually
|
||||
while (true)
|
||||
{
|
||||
if (isConnected() || isClosing() || _stop || !_automaticReconnection)
|
||||
@ -258,7 +259,7 @@ namespace ix
|
||||
|
||||
status = connect(_handshakeTimeoutSecs);
|
||||
|
||||
if (!status.success && !_stop)
|
||||
if (!status.success)
|
||||
{
|
||||
duration = millis(calculateRetryWaitMilliseconds(retries++));
|
||||
|
||||
@ -270,11 +271,15 @@ namespace ix
|
||||
connectErr, WebSocketOpenInfo(),
|
||||
WebSocketCloseInfo());
|
||||
|
||||
// Only sleep if we aren't in the middle of stopping
|
||||
if (!_stop)
|
||||
{
|
||||
std::this_thread::sleep_for(duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WebSocket::run()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user