Fix Cut 5c Soul findings: PVS wire isolation, walker clock/swap/spectator sync, Release Box3D build graph, Packet 2 overflow & bounds checks, L1 timeout/reconnect

This commit is contained in:
Meta Vens 2026-12-05 09:31:05 +01:00
commit 39ad46cd14
15 changed files with 1231 additions and 177 deletions

View file

@ -291,11 +291,7 @@ public partial class Main : Node3D
private void StartListenHostSession(string hostArg, string callsign)
{
_callsign = string.IsNullOrWhiteSpace(callsign) ? "Host" : callsign.Trim();
_session?.Dispose();
_session = null;
_boundViewState = null;
_wasNetConnected = false;
string nextCallsign = string.IsNullOrWhiteSpace(callsign) ? "Host" : callsign.Trim();
Failure = null;
_hud.SetNetworkError(null);
@ -303,15 +299,26 @@ public partial class Main : Node3D
{
ParseBindAndPort(hostArg, IPAddress.Loopback, DefaultNetPort, out IPAddress bindIp, out int port);
var hostSession = new ListenHostArenaSession(bindIp, port, _seed, _mapKind);
hostSession.Host.Session.SetHumanSlot(0, true, _callsign);
hostSession.Host.Session.SetHumanSlot(0, true, nextCallsign);
var oldSession = _session;
_session = hostSession;
_callsign = nextCallsign;
_boundViewState = null;
_wasNetConnected = false;
_lastEndpoint = $"{bindIp}:{hostSession.Host.BoundPort}";
_hud.SetNetworkDefaults(_lastEndpoint, _callsign);
BindSessionPresentation(resetCamera: true);
oldSession?.Dispose();
}
catch (Exception ex)
{
Failure = ex.Message;
if (_session is null)
{
_session = new LocalArenaSession(_seed, _mapKind, _callsign);
BindSessionPresentation(resetCamera: false);
}
_hud.SetNetworkError(ex.Message);
GD.PushError("ListenHostArenaSession startup failed: " + ex);
}
@ -319,27 +326,34 @@ public partial class Main : Node3D
private void StartRemoteSession(string endpointText, string callsign)
{
_callsign = string.IsNullOrWhiteSpace(callsign) ? "Pilot" : callsign.Trim();
_session?.Dispose();
_session = null;
_boundViewState = null;
_wasNetConnected = false;
string nextCallsign = string.IsNullOrWhiteSpace(callsign) ? "Pilot" : callsign.Trim();
Failure = null;
_hud.SetNetworkError(null);
try
{
IPEndPoint ep = ResolveEndPoint(endpointText, DefaultNetPort);
var remote = new RemoteArenaSession(ep, _callsign);
var remote = new RemoteArenaSession(ep, nextCallsign);
remote.PumpNetwork();
var oldSession = _session;
_session = remote;
_callsign = nextCallsign;
_boundViewState = null;
_wasNetConnected = false;
_lastEndpoint = endpointText.Trim();
_hud.SetNetworkDefaults(_lastEndpoint, _callsign);
BindSessionPresentation(resetCamera: true);
oldSession?.Dispose();
}
catch (Exception ex)
{
Failure = ex.Message;
if (_session is null)
{
_session = new LocalArenaSession(_seed, _mapKind, _callsign);
BindSessionPresentation(resetCamera: false);
}
_hud.SetNetworkError(ex.Message);
GD.PushError("RemoteArenaSession startup failed: " + ex);
}