mirror of
https://github.com/rustdesk/rustdesk-server.git
synced 2026-07-12 17:53:54 +00:00
91fb928c6e
`Duration::as_millis()` returns u128; casting it `as i32` in the online-status and punch-hole checks keeps only the low 32 bits as a signed integer. Once a peer has not registered for more than 2^31 ms (~24.855 days), the value wraps negative and passes the `elapsed < REG_TIMEOUT` test, so a long-offline peer is reported online and connection attempts are relayed to its stale socket_addr. The in-memory peer map is never evicted, so last_reg_time stays frozen until hbbs restarts, making the false-online window 24.86-49.71 days (and it repeats every ~49.71 days). Widen REG_TIMEOUT and the two elapsed casts from i32 to i64 so the comparison no longer overflows. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>