Skip to content

Commit d58aa3a

Browse files
authored
fix: comms fail to recover after network disconnect (#8812)
1 parent 6b37b4a commit d58aa3a

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

Explorer/Assets/DCL/Multiplayer/Connections/Archipelago/Rooms/ChatConnectiveRoom.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected override UniTask PrewarmAsync(CancellationToken token)
5454
protected override async UniTask CycleStepAsync(CancellationToken token)
5555
{
5656
if (CurrentState() is not IConnectiveRoom.State.Running // CurrentState will be != Running at start, so we need to connect
57-
|| Room().Info.ConnectionState == LKConnectionState.ConnDisconnected) // If the room was running but our connection was lost at some point, we need to reconnect
57+
|| Room().Info.ConnectionState != LKConnectionState.ConnConnected) // If the room was running but our connection was lost (or stuck reconnecting), we need to reconnect
5858
{
5959
string connectionString = await ConnectionStringAsync(token);
6060
await TryConnectToRoomAsync(connectionString, token);

Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Meta/SceneRoomMetaDataSource.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ public async UniTask<Result<MetaData>> MetaDataAsync(MetaData.Input input, Cance
9494

9595
StreamableLoadingResult<SceneDefinitions> result = promise.Result!.Value;
9696

97-
if (result.Succeeded && entityDefinitionList.Count > 0)
97+
// Don't collapse a network failure into "no scene at this position":
98+
// that path parks the room until the player changes parcel.
99+
if (!result.Succeeded)
100+
return Result<MetaData>.ErrorResult(result.Exception?.Message ?? "Failed to fetch scene definition");
101+
102+
if (entityDefinitionList.Count > 0)
98103
{
99104
SceneEntityDefinition? sceneDefinition = entityDefinitionList[0];
100105
string? id = sceneDefinition.id;

Explorer/Assets/DCL/Multiplayer/Connections/GateKeeper/Rooms/GateKeeperSceneRoom.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ async UniTask WaitForMetadataIsDirtyAsync(CancellationToken token)
155155
}
156156
else
157157
{
158-
if (!meta.Equals(currentMetaData.GetValueOrDefault()) || Room().Info.ConnectionState == LKConnectionState.ConnDisconnected)
158+
if (!meta.Equals(currentMetaData.GetValueOrDefault()) || Room().Info.ConnectionState != LKConnectionState.ConnConnected)
159159
{
160160
string connectionString = await ConnectionStringAsync(meta, token);
161161

162-
if (Room().Info.ConnectionState == LKConnectionState.ConnDisconnected)
162+
if (Room().Info.ConnectionState != LKConnectionState.ConnConnected)
163163
currentMetaData = null;
164164

165165
// if the player returns to the previous scene but the new room has been connected, the previous connection should be preserved

0 commit comments

Comments
 (0)