mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
fix(multiplayer): harden reconnect lifecycle fencing
This commit is contained in:
@@ -438,8 +438,9 @@ func _reserve_join_authorisation(token: String, peer_id: int) -> int:
|
||||
var now := Time.get_unix_time_from_system()
|
||||
var history: Dictionary = _join_history.get(token, {})
|
||||
var lost_at := float(history.get("lost_at", 0.0))
|
||||
if lost_at > 0.0 and now - lost_at > RECONNECT_GRACE_SECONDS:
|
||||
return -1
|
||||
if lost_at > 0.0:
|
||||
if now < lost_at or now - lost_at > RECONNECT_GRACE_SECONDS:
|
||||
return -1
|
||||
var generation := int(history.get("generation", 0)) + 1
|
||||
_join_history[token] = {"generation": generation, "lost_at": 0.0}
|
||||
_active_join_peers[token] = peer_id
|
||||
|
||||
Reference in New Issue
Block a user