From 177131837d4c57c6cf74149fb0eb48768b5e878f Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Fri, 19 Apr 2024 16:55:33 +0530 Subject: [PATCH] Fixed newer presencemessage checks and decoding recovery key --- src/IO.Ably.Shared/Extensions/PresenceExtensions.cs | 4 ++-- src/IO.Ably.Shared/Realtime/RecoveryKeyContext.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/IO.Ably.Shared/Extensions/PresenceExtensions.cs b/src/IO.Ably.Shared/Extensions/PresenceExtensions.cs index 49d13126b..1229674b9 100644 --- a/src/IO.Ably.Shared/Extensions/PresenceExtensions.cs +++ b/src/IO.Ably.Shared/Extensions/PresenceExtensions.cs @@ -13,7 +13,7 @@ public static bool IsNewerThan(this PresenceMessage thisMessage, PresenceMessage // RTP2b1 if (thisMessage.IsSynthesized() || thatMessage.IsSynthesized()) { - return thisMessage.Timestamp > thatMessage.Timestamp; + return thisMessage.Timestamp >= thatMessage.Timestamp; } // RTP2b2 @@ -35,7 +35,7 @@ public static bool IsNewerThan(this PresenceMessage thisMessage, PresenceMessage if (msgSerialThis == msgSerialThat) { - return indexThis > indexThat; + return indexThis >= indexThat; } return msgSerialThis > msgSerialThat; diff --git a/src/IO.Ably.Shared/Realtime/RecoveryKeyContext.cs b/src/IO.Ably.Shared/Realtime/RecoveryKeyContext.cs index db1da65ac..d55ec9427 100644 --- a/src/IO.Ably.Shared/Realtime/RecoveryKeyContext.cs +++ b/src/IO.Ably.Shared/Realtime/RecoveryKeyContext.cs @@ -26,9 +26,9 @@ public static RecoveryKeyContext Decode(string recover, ILogger logger = null) { return JsonHelper.Deserialize(recover); } - catch (Exception) + catch (Exception e) { - logger?.Warning($"Error deserializing recover - {recover}, setting it as null"); + logger?.Warning($"Error deserializing recover - {recover}, setting it as null", e); return null; } }