Skip to content

Commit 43abf65

Browse files
committed
more fixes back to a good state hopefully
1 parent 6d1f234 commit 43abf65

10 files changed

Lines changed: 31 additions & 23 deletions

File tree

Basis Server/BasisNetworkCore/BasisServerConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public class Configuration
115115
/// Clients fall back to keyframe+delta when this is false, and also whenever they hold a direct
116116
/// P2P session — see BasisNetworkAvatarCompressor for why.
117117
/// </summary>
118-
public bool EnableUplinkAvatarStream = true;
118+
public bool EnableUplinkAvatarStream = false;
119119
public bool EnableBSRProfiling = false;
120120
/// <summary>
121121
/// Worker cap for the BSR tick's parallel phases (send loop, message processing, distance

Basis Server/BasisNetworkServer/BasisServerHandleEvents.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,16 @@ public static void OnNetworkError(IPEndPoint endPoint, SocketError socketError)
347347
/// </summary>
348348
private static bool CleanupPeerSubsystems(NetPeer peer, int id)
349349
{
350+
// A predecessor's disconnect can land after a reconnect has already taken the same id.
351+
// Every teardown below is keyed by id alone, so running it for a peer that no longer
352+
// owns the slot dismantles the live peer's state instead — the "direct connect works,
353+
// then dies after a rejoin" symptom. An id held by nobody still cleans up, so a peer
354+
// rejected before auth completed keeps releasing whatever partial state it made.
355+
if (NetworkServer.AuthenticatedPeers.TryGetValue(id, out NetPeer holder) && !ReferenceEquals(holder, peer))
356+
{
357+
return false;
358+
}
359+
350360
// The auth-identity map is the primary UUID source, but it is empty when
351361
// UseAuthIdentity is off and can already be evicted on a reconnect collision. The
352362
// stored connect metadata carries the same server-computed UUID (OnNetworkAccepted
@@ -381,7 +391,10 @@ private static bool CleanupPeerSubsystems(NetPeer peer, int id)
381391
BasisServerMessageRegistry.ClearSubscription(id);
382392
JoinBroadcast.UnregisterPeer(id);
383393

384-
return NetworkServer.AuthenticatedPeers.TryRemove(id, out _);
394+
// Value-matched, mirroring RejectWithReason(NetPeer): the guard above raced against a
395+
// reconnect that may have claimed the id since.
396+
return ((ICollection<KeyValuePair<int, NetPeer>>)NetworkServer.AuthenticatedPeers)
397+
.Remove(new KeyValuePair<int, NetPeer>(id, peer));
385398
}
386399

387400
public static void HandlePeerDisconnected(NetPeer peer, DisconnectInfo info)

Basis Server/BasisServerTests/ConfigAndRegistryTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void Defaults_V42BandwidthFeatures()
107107
Assert.Equal(2000, cfg.AvatarDeltaKeyframeMaxIntervalMs);
108108
Assert.True(cfg.StripAdditionalDataAtLowQuality);
109109
Assert.True(cfg.EnableUplinkAvatarDelta);
110-
Assert.True(cfg.EnableUplinkAvatarStream);
110+
Assert.False(cfg.EnableUplinkAvatarStream);
111111
}
112112

113113
[Fact]

Basis/Assets/Resources/PerformanceTestRunInfo.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

Basis/Assets/Resources/PerformanceTestRunInfo.json.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

Basis/Assets/Resources/PerformanceTestRunSettings.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

Basis/Assets/Resources/PerformanceTestRunSettings.json.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

Basis/Packages/com.basis.server/BasisNetworkCore/BasisServerConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public class Configuration
115115
/// Clients fall back to keyframe+delta when this is false, and also whenever they hold a direct
116116
/// P2P session — see BasisNetworkAvatarCompressor for why.
117117
/// </summary>
118-
public bool EnableUplinkAvatarStream = true;
118+
public bool EnableUplinkAvatarStream = false;
119119
public bool EnableBSRProfiling = false;
120120
/// <summary>
121121
/// Worker cap for the BSR tick's parallel phases (send loop, message processing, distance

Basis/Packages/com.basis.server/BasisNetworkServer/BasisServerHandleEvents.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,16 @@ public static void OnNetworkError(IPEndPoint endPoint, SocketError socketError)
347347
/// </summary>
348348
private static bool CleanupPeerSubsystems(NetPeer peer, int id)
349349
{
350+
// A predecessor's disconnect can land after a reconnect has already taken the same id.
351+
// Every teardown below is keyed by id alone, so running it for a peer that no longer
352+
// owns the slot dismantles the live peer's state instead — the "direct connect works,
353+
// then dies after a rejoin" symptom. An id held by nobody still cleans up, so a peer
354+
// rejected before auth completed keeps releasing whatever partial state it made.
355+
if (NetworkServer.AuthenticatedPeers.TryGetValue(id, out NetPeer holder) && !ReferenceEquals(holder, peer))
356+
{
357+
return false;
358+
}
359+
350360
// The auth-identity map is the primary UUID source, but it is empty when
351361
// UseAuthIdentity is off and can already be evicted on a reconnect collision. The
352362
// stored connect metadata carries the same server-computed UUID (OnNetworkAccepted
@@ -381,7 +391,10 @@ private static bool CleanupPeerSubsystems(NetPeer peer, int id)
381391
BasisServerMessageRegistry.ClearSubscription(id);
382392
JoinBroadcast.UnregisterPeer(id);
383393

384-
return NetworkServer.AuthenticatedPeers.TryRemove(id, out _);
394+
// Value-matched, mirroring RejectWithReason(NetPeer): the guard above raced against a
395+
// reconnect that may have claimed the id since.
396+
return ((ICollection<KeyValuePair<int, NetPeer>>)NetworkServer.AuthenticatedPeers)
397+
.Remove(new KeyValuePair<int, NetPeer>(id, peer));
385398
}
386399

387400
public static void HandlePeerDisconnected(NetPeer peer, DisconnectInfo info)

Basis/ProjectSettings/ProjectSettings.asset

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ PlayerSettings:
152152
preloadedAssets:
153153
- {fileID: 11400000, guid: cf469a9a31a25dc449c2537cb0b17ad6, type: 2}
154154
- {fileID: -944628639613478452, guid: 5e4c3601c6a155f43af19da3bdd35a64, type: 3}
155-
- {fileID: 4183660298247459095, guid: ad3dbbd57db07a1488d166f19ed6e7dc, type: 2}
156-
- {fileID: -5957691810772215966, guid: 1d5aae00e097ba9419be9ec26ccae856, type: 2}
157155
metroInputSource: 0
158156
wsaTransparentSwapchain: 0
159157
xboxOneDisableKinectGpuReservation: 1

0 commit comments

Comments
 (0)