diff --git a/SocketRocket/SRWebSocket.m b/SocketRocket/SRWebSocket.m index 83f3e128f..8389828b1 100644 --- a/SocketRocket/SRWebSocket.m +++ b/SocketRocket/SRWebSocket.m @@ -550,14 +550,13 @@ - (void)_failWithError:(NSError *)error; dispatch_async(_workQueue, ^{ if (self.readyState != SR_CLOSED) { _failed = YES; + self.readyState = SR_CLOSED; [self.delegateController performDelegateBlock:^(id _Nullable delegate, SRDelegateAvailableMethods availableMethods) { if (availableMethods.didFailWithError) { [delegate webSocket:self didFailWithError:error]; } }]; - self.readyState = SR_CLOSED; - SRDebugLog(@"Failing with error %@", error.localizedDescription); [self closeConnection];