Fix i32 overflow in online status reporting for peers - #24
Closed
YuZhiYuanDev wants to merge 15 commits into
Closed
Conversation
#676) `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>
Bumps [libs/hbb_common](https://github.com/rustdesk/hbb_common) from `83419b6` to `5438d20`. - [Release notes](https://github.com/rustdesk/hbb_common/releases) - [Commits](rustdesk/hbb_common@83419b6...5438d20) --- updated-dependencies: - dependency-name: libs/hbb_common dependency-version: 5438d2022513573094c860e4035b4fb32a8e7787 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Update protobuf to 3.7.2 Signed-off-by: Julien Arnaud <julien.arnaud@sib-retail.com> * Harden protobuf recursion regression Signed-off-by: Julien Arnaud <julien.arnaud@sib-retail.com> --------- Signed-off-by: Julien Arnaud <julien.arnaud@sib-retail.com> Co-authored-by: Julien Arnaud <julien.arnaud@sib-retail.com>
Bumps [libs/hbb_common](https://github.com/rustdesk/hbb_common) from `5438d20` to `69cea8d`. - [Release notes](https://github.com/rustdesk/hbb_common/releases) - [Commits](rustdesk/hbb_common@5438d20...69cea8d) --- updated-dependencies: - dependency-name: libs/hbb_common dependency-version: 69cea8dafee147848ae88702029f4bf7df7224c3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.