Skip to content

Commit 0f440c0

Browse files
Don't go through sendPing: when unfreezing an account
If we go through the MLXMPPManager's connectIfNecessary, we don't want to prevent a race condition with disconnect:, like sendPing: does: we already know that we were cleanly disconnected and always want to connect again. But for good measure we still try to simply ping instead of doing a real (re)connect, if we detect we are somehow still connected or at least seem to be (the ping will bring clarity).
1 parent d1124a8 commit 0f440c0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Monal/Classes/MLXMPPManager.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,16 @@ -(void) connectAccountWithDictionary:(NSDictionary*) account
526526
}
527527
DDLogInfo(@"existing account, calling unfreeze");
528528
[existing unfreeze];
529-
DDLogInfo(@"existing account, just pinging.");
530-
[existing sendPing:SHORT_PING]; //short ping timeout to quickly check if connectivity is still okay
529+
if(existing.accountState<kStateReconnecting)
530+
{
531+
DDLogInfo(@"disconnected existing account, reconnecting.");
532+
[existing connect];
533+
}
534+
else
535+
{
536+
DDLogInfo(@"connected(?) existing account, just pinging.");
537+
[existing sendPing:SHORT_PING]; //short ping timeout to quickly check if connectivity is still okay
538+
}
531539
return;
532540
}
533541
DDLogVerbose(@"connecting account %@@%@",[account objectForKey:kUsername], [account objectForKey:kDomain]);

0 commit comments

Comments
 (0)