From c3d3db6d4ad18fe4b2d9f0132fb6c607a035f065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Sun, 11 Dec 2022 10:30:18 +0100 Subject: [PATCH] Correctly reset the websocket in all cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- NextcloudTalk/NCExternalSignalingController.m | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/NextcloudTalk/NCExternalSignalingController.m b/NextcloudTalk/NCExternalSignalingController.m index e5548150..53b17d17 100644 --- a/NextcloudTalk/NCExternalSignalingController.m +++ b/NextcloudTalk/NCExternalSignalingController.m @@ -159,11 +159,7 @@ static NSTimeInterval kWebSocketTimeoutInterval = 15; [self executeAllCompletionBlocksWithError]; - [_webSocket cancel]; - _webSocket = nil; - _helloResponseReceived = NO; - [_helloMessage ignoreCompletionBlock]; - _helloMessage = nil; + [self resetWebSocket]; [self setReconnectionTimer]; } @@ -180,13 +176,20 @@ static NSTimeInterval kWebSocketTimeoutInterval = 15; { dispatch_async(dispatch_get_main_queue(), ^{ [self invalidateReconnectionTimer]; - [self->_webSocket cancel]; - self->_webSocket = nil; - self->_helloResponseReceived = NO; - self->_disconnected = YES; + [self resetWebSocket]; }); } +- (void)resetWebSocket +{ + [_webSocket cancel]; + _webSocket = nil; + _helloResponseReceived = NO; + [_helloMessage ignoreCompletionBlock]; + _helloMessage = nil; + _disconnected = YES; +} + - (void)setReconnectionTimer { [self invalidateReconnectionTimer];