Track last accepted transform timing

This commit is contained in:
Nomads_Reach
2026-08-15 21:46:38 -04:00
parent fb11d34e95
commit b4fe87e1ca
+8 -1
View File
@@ -14,6 +14,7 @@ class ClientSession:
connected_at: float
last_packet_at: float | None = None
last_transform: dict[str, Any] | None = None
last_transform_monotonic: float | None = None
packets_received: int = 0
packets_sent: int = 0
packets_broadcast: int = 0
@@ -32,9 +33,15 @@ class ClientSession:
self.packets_received += 1
return self.packets_received
def record_transform(self, packet: dict[str, Any]) -> None:
def record_transform(self, packet: dict[str, Any], accepted_monotonic: float | None = None) -> None:
with self._lock:
self.last_transform = dict(packet)
self.last_transform_monotonic = accepted_monotonic
def get_last_transform_anchor(self) -> tuple[dict[str, Any] | None, float | None]:
with self._lock:
transform = dict(self.last_transform) if self.last_transform is not None else None
return transform, self.last_transform_monotonic
def record_sent(self, *, broadcast: bool = False) -> None:
with self._lock: