Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance P2P Layer: Stream Removal Tracking and Cooldown Handling #4853

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

GheisMohammadi
Copy link
Contributor

This PR improves the P2P layer by introducing a cooldown mechanism for removed streams. Previously, when a stream was removed, the next peer discovery cycle could reconnect to the same stream immediately, potentially causing issues if the peer was invalid or unsynced. This could prevent our node from fully syncing.

Key Changes

Added RemovalInfo struct to track the removal timestamp, expiration time, and removal count for each stream.
Introduced RemovalCooldownDuration (default: 60 minutes) to enforce a cooldown period before a removed stream can be reconnected.
Updated streamManager.handleAddStream to check if a stream was recently removed before allowing reconnection.
Ensured removed streams are stored in removedStreams and properly marked when removal occurs.
Refactored variable names and comments for better clarity and maintainability.

@sophoah sophoah merged commit b62c88b into dev Feb 20, 2025
4 checks passed
@sophoah sophoah deleted the feature/stream_manager_removal branch February 20, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants