diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 4f4049f94..de22b007d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -35,7 +35,7 @@ END TEMPLATE--> ### Breaking changes -*None yet* +* When a player disconnects, the relevant callbacks are now fired *after* removing the channel from `INetManager`. ### New features diff --git a/Robust.Shared/Network/NetManager.cs b/Robust.Shared/Network/NetManager.cs index 05ff33e9d..c38c63759 100644 --- a/Robust.Shared/Network/NetManager.cs +++ b/Robust.Shared/Network/NetManager.cs @@ -827,6 +827,10 @@ namespace Robust.Shared.Network _assignedUsernames.Remove(channel.UserName); _assignedUserIds.Remove(channel.UserId); + _channels.Remove(connection); + peer.RemoveChannel(channel); + channel.EncryptionChannel?.Complete(); + #if EXCEPTION_TOLERANCE try { @@ -842,9 +846,6 @@ namespace Robust.Shared.Network _logger.Error("Caught exception in OnDisconnected handler:\n{0}", e); } #endif - _channels.Remove(connection); - peer.RemoveChannel(channel); - channel.EncryptionChannel?.Complete(); if (IsClient) {