Skip to content

Commit 1f47da8

Browse files
authored
Merge pull request #6741 from decentraland/fix/duplicate_identity_FF
fix: Added FF to disable Duplicate Identity checking
2 parents b92c7b2 + 1fb3f43 commit 1f47da8

5 files changed

Lines changed: 20 additions & 13 deletions

File tree

Explorer/Assets/DCL/FeatureFlags/FeatureFlagsStrings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public static class FeatureFlagsStrings
5151
public const string BANNED_USERS_FROM_SCENE = "alfa-banned-users-from-scene";
5252
public const string HEAD_SYNC = "alfa-head-sync";
5353
public const string DISCOVER = "alfa-discover";
54+
public const string STOP_ON_DUPLICATE_IDENTITY = "alfa-stop-on-duplicate-identity";
5455

5556
public static class Endpoints
5657
{

Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public FeaturesRegistry(
3737
[FeatureId.PROFILE_NAME_EDITOR] = featureFlags.IsEnabled(FeatureFlagsStrings.PROFILE_NAME_EDITOR) || (appArgs.HasDebugFlag() && appArgs.HasFlag(AppArgsFlags.PROFILE_NAME_EDITOR)) || Application.isEditor,
3838
[FeatureId.LOCAL_SCENE_DEVELOPMENT] = localSceneDevelopment,
3939
[FeatureId.HEAD_SYNC] = featureFlags.IsEnabled(FeatureFlagsStrings.HEAD_SYNC) || (appArgs.HasDebugFlag() && appArgs.HasFlag(AppArgsFlags.HEAD_SYNC)) || Application.isEditor,
40+
[FeatureId.STOP_ON_DUPLICATE_IDENTITY] = featureFlags.IsEnabled(FeatureFlagsStrings.STOP_ON_DUPLICATE_IDENTITY),
4041
// Note: COMMUNITIES feature is not cached here because it depends on user identity
4142
});
4243

@@ -138,5 +139,6 @@ public enum FeatureId
138139
GPUI_ENABLED,
139140
GIFTING_ENABLED,
140141
HEAD_SYNC,
142+
STOP_ON_DUPLICATE_IDENTITY,
141143
}
142144
}

Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,13 @@ await MapRendererContainer
992992
mvcManager,
993993
thumbnailProvider,
994994
identityCache),
995-
new DuplicateIdentityPlugin(roomHub, mvcManager, assetsProvisioner),
996995
new AvatarLocomotionOverridesGlobalPlugin(),
997996
};
998997

998+
// ReSharper disable once MethodHasAsyncOverloadWithCancellation
999+
if (FeaturesRegistry.Instance.IsEnabled(FeatureId.STOP_ON_DUPLICATE_IDENTITY))
1000+
globalPlugins.Add(new DuplicateIdentityPlugin(roomHub, mvcManager, assetsProvisioner));
1001+
9991002
// ReSharper disable once MethodHasAsyncOverloadWithCancellation
10001003
if (FeaturesRegistry.Instance.IsEnabled(FeatureId.VOICE_CHAT))
10011004
globalPlugins.Add(

Explorer/Assets/DCL/Multiplayer/Connections/DCL.Multiplayer.Connections.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"GUID:9e314663ce958b746873cb22d57ede55",
2121
"GUID:d8b63aba1907145bea998dd612889d6b",
2222
"GUID:1087662aaf1c5462baa91fb9484296fd",
23-
"GUID:8baf705856414dad9a73b3f382f1bc8b"
23+
"GUID:8baf705856414dad9a73b3f382f1bc8b",
24+
"GUID:ace653ac543d483ba8abee112a3ba2a6"
2425
],
2526
"includePlatforms": [],
2627
"excludePlatforms": [],

Explorer/Assets/DCL/Multiplayer/Connections/Rooms/Connective/ConnectiveRoom.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Cysharp.Threading.Tasks;
22
using DCL.Diagnostics;
3-
using DCL.Multiplayer.Connections.Audio;
3+
using DCL.FeatureFlags;
44
using DCL.Multiplayer.Connections.Credentials;
55
using DCL.WebRequests;
66
using LiveKit.Internal;
@@ -53,17 +53,14 @@ public abstract class ConnectiveRoom : IConnectiveRoom
5353
{
5454
private static readonly TimeSpan HEARTBEATS_INTERVAL = TimeSpan.FromSeconds(1);
5555
private static readonly TimeSpan CONNECTION_LOOP_RECOVER_INTERVAL = TimeSpan.FromSeconds(5);
56-
private readonly string logPrefix;
5756

57+
private readonly string logPrefix;
5858
private readonly InteriorRoom room = new ();
59-
6059
private readonly Atomic<IConnectiveRoom.ConnectionLoopHealth> connectionLoopHealth = new (IConnectiveRoom.ConnectionLoopHealth.Stopped);
61-
6260
private readonly Atomic<AttemptToConnectState> attemptToConnectState = new (AttemptToConnectState.NONE);
63-
6461
private readonly Atomic<IConnectiveRoom.State> roomState = new (IConnectiveRoom.State.Stopped);
65-
6662
private readonly IObjectPool<IRoom> roomPool;
63+
private readonly bool isDuplicateIdentityStopFeatureEnabled;
6764

6865
private CancellationTokenSource? cancellationTokenSource;
6966
private bool isDuplicateIdentityDetected;
@@ -72,6 +69,8 @@ public abstract class ConnectiveRoom : IConnectiveRoom
7269

7370
protected ConnectiveRoom()
7471
{
72+
isDuplicateIdentityStopFeatureEnabled = FeaturesRegistry.Instance.IsEnabled(FeatureId.STOP_ON_DUPLICATE_IDENTITY);
73+
7574
logPrefix = GetType().Name;
7675

7776
roomPool = new ObjectPool<IRoom>(() =>
@@ -166,9 +165,10 @@ private async UniTaskVoid RunAsync(CancellationToken token)
166165
await UniTask.Delay(HEARTBEATS_INTERVAL, cancellationToken: token);
167166
}
168167

169-
if (isDuplicateIdentityDetected)
168+
169+
if (isDuplicateIdentityDetected && isDuplicateIdentityStopFeatureEnabled)
170170
{
171-
ReportHub.Log(ReportCategory.LIVEKIT, $"{logPrefix} - DuplicateIdentity detected, stopping reconnection loop");
171+
ReportHub.LogWarning(ReportCategory.LIVEKIT, $"{logPrefix} - DuplicateIdentity detected, stopping reconnection loop");
172172
connectionLoopHealth.Set(IConnectiveRoom.ConnectionLoopHealth.Stopped);
173173
attemptToConnectState.Set(AttemptToConnectState.NO_CONNECTION_REQUIRED);
174174
}
@@ -294,13 +294,13 @@ protected async UniTask<RoomSelection> TryConnectToRoomAsync(string connectionSt
294294
return (connectResult, roomSelection);
295295
}
296296

297-
private void OnConnectionUpdated(IRoom room, ConnectionUpdate connectionUpdate, DisconnectReason? disconnectReason = null)
297+
private void OnConnectionUpdated(IRoom _, ConnectionUpdate connectionUpdate, DisconnectReason? disconnectReason)
298298
{
299-
if (connectionUpdate == ConnectionUpdate.Disconnected && disconnectReason == DisconnectReason.DuplicateIdentity)
299+
if (connectionUpdate == ConnectionUpdate.Disconnected && disconnectReason is DisconnectReason.DuplicateIdentity && isDuplicateIdentityStopFeatureEnabled)
300300
{
301301
isDuplicateIdentityDetected = true;
302302
cancellationTokenSource?.SafeCancelAndDispose();
303-
ReportHub.Log(ReportCategory.LIVEKIT, $"{logPrefix} - DuplicateIdentity disconnect reason received, interrupting reconnection attempts");
303+
ReportHub.LogWarning(ReportCategory.LIVEKIT, $"{logPrefix} - DuplicateIdentity disconnect reason received, interrupting reconnection attempts");
304304
}
305305
}
306306
}

0 commit comments

Comments
 (0)