do more mirror work

This commit is contained in:
JohnCorby 2025-02-24 16:26:16 -08:00
parent 54f15d6481
commit 75e2f47111
3 changed files with 6 additions and 2 deletions

View File

@ -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();
}

View File

@ -125,6 +125,7 @@ public static class Program
try
{
var running = true;
transport.OnClientDisconnected = () => running = false; // mirror normally does this
while (running)
{
transport.ClientEarlyUpdate();

View File

@ -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
}
}