-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat: avoid duplicate autoconnection attempt #1742
Merged
Mallets
merged 16 commits into
eclipse-zenoh:main
from
ZettaScaleLabs:feat/autoconnect_single_direction
Feb 7, 2025
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
512a598
feat: avoid duplicate autoconnection attempt
wyfo 62c34d9
refactor: extract autoconnect node selection in a dedicated function
wyfo dc82861
refactor: add a configuration option for autoconnection
wyfo 0856692
revert: revert JSON config formatting
wyfo bd276ea
fix: lint
wyfo 070a733
feat: add an "always" autoconnection strategy
wyfo 33d67fd
docs: document DEFAULT_CONFIG.json5
wyfo 655363e
Update DEFAULT_CONFIG.json5
wyfo 1cf0887
feat: make strategy dependent on the connected node
wyfo fa5c8b4
Update DEFAULT_CONFIG.json5
wyfo 961c8c4
Update DEFAULT_CONFIG.json5
wyfo 1a954a8
fix: remove dead code
wyfo 26a4c62
feat: introduce target-dependent value
wyfo 99917a3
fix: lint
wyfo 5850518
fix: remove dead code
wyfo d727b08
fix: remove debug code
wyfo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,44 +14,44 @@ | |
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"commons/zenoh-buffers", | ||
"commons/zenoh-codec", | ||
"commons/zenoh-collections", | ||
"commons/zenoh-config", | ||
"commons/zenoh-core", | ||
"commons/zenoh-crypto", | ||
"commons/zenoh-keyexpr", | ||
"commons/zenoh-macros", | ||
"commons/zenoh-protocol", | ||
"commons/zenoh-result", | ||
"commons/zenoh-shm", | ||
"commons/zenoh-sync", | ||
"commons/zenoh-task", | ||
"commons/zenoh-util", | ||
"commons/zenoh-runtime", | ||
"examples", | ||
"io/zenoh-link", | ||
"io/zenoh-link-commons", | ||
"io/zenoh-links/zenoh-link-quic/", | ||
"io/zenoh-links/zenoh-link-serial", | ||
"io/zenoh-links/zenoh-link-tcp/", | ||
"io/zenoh-links/zenoh-link-tls/", | ||
"io/zenoh-links/zenoh-link-udp/", | ||
"io/zenoh-links/zenoh-link-unixsock_stream/", | ||
"io/zenoh-links/zenoh-link-ws/", | ||
"io/zenoh-links/zenoh-link-unixpipe/", | ||
"io/zenoh-links/zenoh-link-vsock/", | ||
"io/zenoh-transport", | ||
"plugins/zenoh-backend-example", | ||
"plugins/zenoh-plugin-example", | ||
"plugins/zenoh-backend-traits", | ||
"plugins/zenoh-plugin-rest", | ||
"plugins/zenoh-plugin-storage-manager", | ||
"plugins/zenoh-plugin-trait", | ||
"zenoh", | ||
"zenoh-ext", | ||
"zenoh-ext/examples", | ||
"zenohd", | ||
"commons/zenoh-buffers", | ||
"commons/zenoh-codec", | ||
"commons/zenoh-collections", | ||
"commons/zenoh-config", | ||
"commons/zenoh-core", | ||
"commons/zenoh-crypto", | ||
"commons/zenoh-keyexpr", | ||
"commons/zenoh-macros", | ||
"commons/zenoh-protocol", | ||
"commons/zenoh-result", | ||
"commons/zenoh-shm", | ||
"commons/zenoh-sync", | ||
"commons/zenoh-task", | ||
"commons/zenoh-util", | ||
"commons/zenoh-runtime", | ||
"examples", | ||
"io/zenoh-link", | ||
"io/zenoh-link-commons", | ||
"io/zenoh-links/zenoh-link-quic/", | ||
"io/zenoh-links/zenoh-link-serial", | ||
"io/zenoh-links/zenoh-link-tcp/", | ||
"io/zenoh-links/zenoh-link-tls/", | ||
"io/zenoh-links/zenoh-link-udp/", | ||
"io/zenoh-links/zenoh-link-unixsock_stream/", | ||
"io/zenoh-links/zenoh-link-ws/", | ||
"io/zenoh-links/zenoh-link-unixpipe/", | ||
"io/zenoh-links/zenoh-link-vsock/", | ||
"io/zenoh-transport", | ||
"plugins/zenoh-backend-example", | ||
"plugins/zenoh-plugin-example", | ||
"plugins/zenoh-backend-traits", | ||
"plugins/zenoh-plugin-rest", | ||
"plugins/zenoh-plugin-storage-manager", | ||
"plugins/zenoh-plugin-trait", | ||
"zenoh", | ||
"zenoh-ext", | ||
"zenoh-ext/examples", | ||
"zenohd", | ||
] | ||
exclude = ["ci/nostd-check", "ci/valgrind-check"] | ||
|
||
|
@@ -61,11 +61,11 @@ version = "1.1.1" | |
repository = "https://github.com/eclipse-zenoh/zenoh" | ||
homepage = "http://zenoh.io" | ||
authors = [ | ||
"kydos <[email protected]>", | ||
"Julien Enoch <[email protected]>", | ||
"Olivier Hécart <[email protected]>", | ||
"Luca Cominardi <[email protected]>", | ||
"Pierre Avital <[email protected]>", | ||
"kydos <[email protected]>", | ||
"Julien Enoch <[email protected]>", | ||
"Olivier Hécart <[email protected]>", | ||
"Luca Cominardi <[email protected]>", | ||
"Pierre Avital <[email protected]>", | ||
] | ||
edition = "2021" | ||
license = "EPL-2.0 OR Apache-2.0" | ||
|
@@ -144,9 +144,9 @@ ringbuffer-spsc = "0.1.9" | |
rsa = "0.9" | ||
rustc_version = "0.4.1" | ||
rustls = { version = "0.23.13", default-features = false, features = [ | ||
"logging", | ||
"tls12", | ||
"ring", | ||
"logging", | ||
"tls12", | ||
"ring", | ||
] } | ||
rustls-native-certs = "0.8.0" | ||
rustls-pemfile = "2.1.3" | ||
|
@@ -155,9 +155,10 @@ rustls-pki-types = "1.8.0" | |
schemars = { version = "0.8.21", features = ["either"] } | ||
secrecy = { version = "0.8.0", features = ["serde", "alloc"] } | ||
serde = { version = "1.0.210", default-features = false, features = [ | ||
"derive", | ||
"derive", | ||
] } # Default features are disabled due to usage in no_std crates | ||
serde_json = "1.0.128" | ||
serde_with = "3.12.0" | ||
serde_yaml = "0.9.34" | ||
static_init = "1.0.3" | ||
stabby = "36.1.1" | ||
|
@@ -182,7 +183,7 @@ unzip-n = "0.1.2" | |
url = "2.5.2" | ||
urlencoding = "2.1.3" | ||
uuid = { version = "1.10.0", default-features = false, features = [ | ||
"v4", | ||
"v4", | ||
] } # Default features are disabled due to usage in no_std crates | ||
validated_struct = "2.1.0" | ||
vec_map = "0.8.2" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,19 @@ | |
/// or different values for router, peer or client mode (e.g. autoconnect: { router: [], peer: ["router", "peer"] }). | ||
/// Each value is a list of: "peer", "router" and/or "client". | ||
autoconnect: { router: [], peer: ["router", "peer"], client: ["router"] }, | ||
/// Strategy for autoconnection, mainly to avoid nodes connecting to each other redundantly. | ||
/// Possible options are: | ||
/// - "always": always attempt to autoconnect, may result in redundant connection which will then be closed. | ||
/// - "greater-zid": attempt to connect to another node only if its own zid is greater than the other's. | ||
/// If both nodes use this strategy, only one will attempt the connection. | ||
/// This strategy may not be suited if one of the nodes is not reachable by the other one, for example | ||
/// because of a private IP. | ||
/// Accepts a single value (e.g. autoconnect: "always") which applies whatever node would be auto-connected to, | ||
/// or different values for router and/or peer depending on the type of node detected | ||
/// (e.g. autoconnect_strategy : { "to-router": "always", "to-peer": "greater-zid" }), | ||
/// or different values for router or peer mode | ||
/// (e.g. autoconnect_strategy : { peer: { "to-router": "always", "to-peer": "greater-zid" } }). | ||
autoconnect_strategy: { peer: { "to-router": "always", "to-peer": "always" } }, | ||
/// Whether or not to listen for scout messages on UDP multicast and reply to them. | ||
listen: true, | ||
}, | ||
|
@@ -161,6 +174,19 @@ | |
/// or different values for router or peer mode (e.g. autoconnect: { router: [], peer: ["router", "peer"] }). | ||
/// Each value is a list of: "peer" and/or "router". | ||
autoconnect: { router: [], peer: ["router", "peer"] }, | ||
/// Strategy for autoconnection, mainly to avoid nodes connecting to each other redundantly. | ||
/// Possible options are: | ||
/// - "always": always attempt to autoconnect, may result in redundant connection which will then be closed. | ||
/// - "greater-zid": attempt to connect to another node only if its own zid is greater than the other's. | ||
/// If both nodes use this strategy, only one will attempt the connection. | ||
/// This strategy may not be suited if one of the nodes is not reachable by the other one, for example | ||
/// because of a private IP. | ||
/// Accepts a single value (e.g. autoconnect: "always") which applies whatever node would be auto-connected to, | ||
/// or different values for router and/or peer depending on the type of node detected | ||
/// (e.g. autoconnect_strategy : { "to-router": "always", "to-peer": "greater-zid" }), | ||
/// or different values for router or peer mode | ||
/// (e.g. autoconnect_strategy : { peer: { "to-router": "always", "to-peer": "greater-zid" } }). | ||
autoconnect_strategy: { peer: { "to-router": "always", "to-peer": "always" } }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add the default config for router |
||
}, | ||
}, | ||
|
||
|
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add the default config for router
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no default autoconnection for router, I could put the one for peer though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever the current behavior is should be the default, I assume it's "always" for all cases