Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Handle P2P discovery connection error #139

Merged
merged 3 commits into from
Mar 14, 2024
Merged

Handle P2P discovery connection error #139

merged 3 commits into from
Mar 14, 2024

Conversation

tuommaki
Copy link
Contributor

If the initial discovery nodes cannot be connected, handle the error correctly. If no discovery nodes respond, then terminate the program.

If the initial discovery nodes cannot be connected, handle the error
correctly. If no discovery nodes respond, then terminate the program.
@tuommaki tuommaki requested a review from musitdev March 14, 2024 11:25
@tuommaki tuommaki self-assigned this Mar 14, 2024
@@ -281,6 +290,13 @@ async fn run(config: Arc<Config>) -> Result<()> {
}
}

// If we couldn't connect to any P2P nodes, we'll be left out alone forever.
// Useless to run at that point.
if !config.p2p_discovery_addrs.is_empty() && connected_nodes == 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the P2P bootstrap node, the discovery addresses are empty as that's the beacon of the network. In that case it's fine that connected_nodes == 0. For the others: It's useless to continue when no friends are playing with. 🙂

@tuommaki tuommaki merged commit 0119c70 into main Mar 14, 2024
4 checks passed
@tuommaki tuommaki deleted the fix-p2p-init-connect branch March 14, 2024 12:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants