From c0daf2e0ac58310c03a687db0afb3dae7b907f08 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Fri, 8 Sep 2023 00:27:47 +0530 Subject: [PATCH] Refactored realtimeworkflow for resume or recover success --- src/IO.Ably.Shared/Realtime/Workflows/RealtimeWorkflow.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/IO.Ably.Shared/Realtime/Workflows/RealtimeWorkflow.cs b/src/IO.Ably.Shared/Realtime/Workflows/RealtimeWorkflow.cs index 5c9e33c7d..6a312e321 100644 --- a/src/IO.Ably.Shared/Realtime/Workflows/RealtimeWorkflow.cs +++ b/src/IO.Ably.Shared/Realtime/Workflows/RealtimeWorkflow.cs @@ -599,8 +599,8 @@ private void HandleConnectedCommand(SetConnectedStateCommand cmd) { var info = new ConnectionInfo(cmd.Message); - var resumeOrRecoverSuccess = State.Connection.IsResumed(info) && cmd.Message.Error == null; - var isResumedOrRecoveredConnection = State.Connection.Key.IsNotEmpty() || Client.Options.Recover.IsNotEmpty(); // recover will only be used during init, resume will be used for all subsequent requests + var isConnectionResumeOrRecoverAttempt = State.Connection.Key.IsNotEmpty() || Client.Options.Recover.IsNotEmpty(); // recover will only be used during init, resume will be used for all subsequent requests + var resumeOrRecoverSuccess = State.Connection.IsResumed(info) && cmd.Message.Error == null; // RTN15c6 State.Connection.Update(info); @@ -620,13 +620,13 @@ private void HandleConnectedCommand(SetConnectedStateCommand cmd) Client.Options.Recover = null; // RTN16k, explicitly setting null so it won't be used for subsequent connection requests // RTN15c7 - if (isResumedOrRecoveredConnection && !resumeOrRecoverSuccess) + if (isConnectionResumeOrRecoverAttempt && !resumeOrRecoverSuccess) { State.Connection.MessageSerial = 0; } // RTN15g3, RTN15c6, RTN15c7, RTN16l - for resume/recovered or when connection ttl passed, re-attach channels - if (State.Connection.HasConnectionStateTtlPassed(Now) || isResumedOrRecoveredConnection) + if (State.Connection.HasConnectionStateTtlPassed(Now) || isConnectionResumeOrRecoverAttempt) { foreach (var channel in Channels) {