Server scaffold: protocol + config + transport abstraction + tick loop skeleton
- Protocol: PacketType, TLV Body types, QUIC varint, header, input_broadcast and config_update builders, 2-bit body bitpacking helper - Config/model: live-config ServerConfig, basic GameState/Snake/Session - Transport: InMemoryTransport placeholder and QUIC server stub - Server: asyncio tick loop, periodic config_update broadcast, immediate input_broadcast relay; main entry and run.py
This commit is contained in:
10
server/utils.py
Normal file
10
server/utils.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def is_newer(a: int, b: int) -> bool:
|
||||
"""Return True if 16-bit sequence number a is newer than b (wrap-aware).
|
||||
|
||||
Uses half-range window on unsigned 16-bit arithmetic.
|
||||
"""
|
||||
return ((a - b) & 0xFFFF) < 0x8000
|
||||
|
||||
Reference in New Issue
Block a user