Don't delay disconnected state update if already stopped

This commit is contained in:
Pierre-Olivier Latour 2014-04-29 22:06:13 -07:00
parent 420ed719e8
commit 75e6332500

View File

@ -310,7 +310,7 @@ static void _ConnectedTimerCallBack(CFRunLoopTimerRef timer, void* info) {
_activeConnections -= 1; _activeConnections -= 1;
if (_activeConnections == 0) { if (_activeConnections == 0) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (_disconnectDelay > 0.0) { if ((_disconnectDelay > 0.0) && (_source != NULL)) {
CFRunLoopTimerSetNextFireDate(_connectedTimer, CFAbsoluteTimeGetCurrent() + _disconnectDelay); CFRunLoopTimerSetNextFireDate(_connectedTimer, CFAbsoluteTimeGetCurrent() + _disconnectDelay);
} else { } else {
[self _didDisconnect]; [self _didDisconnect];