From 75e2f4711171c6bede730b60eb75762716f52354 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Mon, 24 Feb 2025 16:26:16 -0800 Subject: [PATCH] do more mirror work --- SteamTransport/Client.cs | 5 +++-- SteamTransport/Program.cs | 1 + SteamTransport/Server.cs | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SteamTransport/Client.cs b/SteamTransport/Client.cs index aa64c188..b6fcfd0b 100644 --- a/SteamTransport/Client.cs +++ b/SteamTransport/Client.cs @@ -40,7 +40,7 @@ public class Client IsConnected = false; _transport.OnClientError?.Invoke(TransportError.ConnectionClosed, t.m_info.m_szEndDebug); _transport.OnClientDisconnected?.Invoke(); - // mirror will shutdown transport + // OnClientDisconnected will causes mirror to shutdown the transport break; } }); @@ -80,6 +80,7 @@ public class Client _transport.OnClientDataSent?.Invoke(segment, channelId); else _transport.OnClientError?.Invoke(TransportError.InvalidSend, $"send returned {result}"); + // i dont think we have to check for disconnect result here since the status change handles that } } } @@ -106,6 +107,7 @@ public class Client var result = SteamNetworkingSockets.FlushMessagesOnConnection(_conn); if (result != EResult.k_EResultOK) _transport.OnClientError?.Invoke(TransportError.Unexpected, $"flush returned {result}"); + // i dont think we have to check for disconnect result here since the status change handles that } public void Close() @@ -116,7 +118,6 @@ public class Client IsConnected = false; // should this do error? _transport.OnClientDisconnected?.Invoke(); - // mirror will shutdown transport _onStatusChanged.Dispose(); } diff --git a/SteamTransport/Program.cs b/SteamTransport/Program.cs index 9a1aa98a..13aee820 100644 --- a/SteamTransport/Program.cs +++ b/SteamTransport/Program.cs @@ -125,6 +125,7 @@ public static class Program try { var running = true; + transport.OnClientDisconnected = () => running = false; // mirror normally does this while (running) { transport.ClientEarlyUpdate(); diff --git a/SteamTransport/Server.cs b/SteamTransport/Server.cs index 1508d08e..a46d9822 100644 --- a/SteamTransport/Server.cs +++ b/SteamTransport/Server.cs @@ -73,6 +73,7 @@ public class Server _transport.OnServerDataSent?.Invoke(connectionId, segment, channelId); else _transport.OnServerError?.Invoke(connectionId, TransportError.InvalidSend, $"send returned {result}"); + // i dont think we have to check for disconnect result here since the status change handles that } } } @@ -105,6 +106,7 @@ public class Server var result = SteamNetworkingSockets.FlushMessagesOnConnection(conn); if (result != EResult.k_EResultOK) _transport.OnServerError?.Invoke((int)conn.m_HSteamNetConnection, TransportError.Unexpected, $"flush returned {result}"); + // i dont think we have to check for disconnect result here since the status change handles that } }