mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
fix(multiplayer): fail closed on ticket timestamps
This commit is contained in:
@@ -318,10 +318,15 @@ static func should_recover_queue_after_conflict(operation: String, response_code
|
||||
|
||||
static func normalize_ticket(payload: Dictionary) -> Dictionary:
|
||||
var result := payload.duplicate(true)
|
||||
if result.has("enqueued_at") and result["enqueued_at"] is String:
|
||||
result["enqueued_at_unix"] = Time.get_unix_time_from_datetime_string(String(result["enqueued_at"]))
|
||||
if result.has("expires_at") and result["expires_at"] is String:
|
||||
result["expires_at_unix"] = Time.get_unix_time_from_datetime_string(String(result["expires_at"]))
|
||||
for pair in [["enqueued_at", "enqueued_at_unix"], ["expires_at", "expires_at_unix"]]:
|
||||
var source_key: String = pair[0]
|
||||
var target_key: String = pair[1]
|
||||
if not result.has(source_key):
|
||||
continue
|
||||
if not result[source_key] is String or not is_valid_rfc3339_timestamp(String(result[source_key])):
|
||||
result[target_key] = -1
|
||||
else:
|
||||
result[target_key] = Time.get_unix_time_from_datetime_string(String(result[source_key]))
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user