Skip to content

Commit 2fb038f

Browse files
authored
Merge pull request #6754 from decentraland/chore/sync
chore: sync main to dev
2 parents 850266b + fcfe507 commit 2fb038f

5 files changed

Lines changed: 21 additions & 14 deletions

File tree

Explorer/Assets/DCL/FeatureFlags/FeatureFlagsStrings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public static class FeatureFlagsStrings
5555
public const string HEAD_SYNC = "alfa-head-sync";
5656
public const string PRIVATE_CHAT_REQUIRES_TOPIC = "alfa-private-chat-requires-topic";
5757
public const string DISCOVER = "alfa-discover";
58+
public const string STOP_ON_DUPLICATE_IDENTITY = "alfa-stop-on-duplicate-identity";
5859

5960
public static class Endpoints
6061
{

Explorer/Assets/DCL/FeatureFlags/FeaturesRegistry.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public FeaturesRegistry(
3939
[FeatureId.CHAT_MESSAGE_RATE_LIMIT] = featureFlags.IsEnabled(FeatureFlagsStrings.CHAT_MESSAGE_RATE_LIMIT),
4040
[FeatureId.CHAT_MESSAGE_BUFFER] = featureFlags.IsEnabled(FeatureFlagsStrings.CHAT_MESSAGE_BUFFER_CONFIG),
4141
[FeatureId.HEAD_SYNC] = featureFlags.IsEnabled(FeatureFlagsStrings.HEAD_SYNC) || (appArgs.HasDebugFlag() && appArgs.HasFlag(AppArgsFlags.HEAD_SYNC)) || Application.isEditor,
42+
[FeatureId.STOP_ON_DUPLICATE_IDENTITY] = featureFlags.IsEnabled(FeatureFlagsStrings.STOP_ON_DUPLICATE_IDENTITY),
4243
[FeatureId.PRIVATE_CHAT_REQUIRES_TOPIC] = featureFlags.IsEnabled(FeatureFlagsStrings.PRIVATE_CHAT_REQUIRES_TOPIC),
4344
// Note: COMMUNITIES feature is not cached here because it depends on user identity
4445
});
@@ -143,6 +144,7 @@ public enum FeatureId
143144
CHAT_MESSAGE_RATE_LIMIT,
144145
CHAT_MESSAGE_BUFFER,
145146
HEAD_SYNC,
147+
STOP_ON_DUPLICATE_IDENTITY,
146148
PRIVATE_CHAT_REQUIRES_TOPIC,
147149
}
148150
}

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

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

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

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
"GUID:9e314663ce958b746873cb22d57ede55",
2121
"GUID:d8b63aba1907145bea998dd612889d6b",
2222
"GUID:1087662aaf1c5462baa91fb9484296fd",
23-
"GUID:45f6fff651a0a514f8edfdaf9cce45af",
24-
"GUID:8baf705856414dad9a73b3f382f1bc8b"
23+
"GUID:8baf705856414dad9a73b3f382f1bc8b",
24+
"GUID:ace653ac543d483ba8abee112a3ba2a6",
25+
"GUID:45f6fff651a0a514f8edfdaf9cce45af"
2526
],
2627
"includePlatforms": [],
2728
"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)