Skip to content

Commit

Permalink
Add connection retry
Browse files Browse the repository at this point in the history
 - Introduce connection retry config for listen and connect endpoints.
 - Listener initialisation reworked to add the connection retry.
 - Connection initialization reworked to be consistent with listening where it posible
 - Some configuration refactoring (ModeDependent related code moved to separate file)
  • Loading branch information
sashacmc committed Mar 19, 2024
1 parent 0bdd136 commit 6216719
Show file tree
Hide file tree
Showing 10 changed files with 996 additions and 366 deletions.
121 changes: 3 additions & 118 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions DEFAULT_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,31 @@
/// For TCP/UDP on Linux, it is possible additionally specify the interface to be connected to:
/// E.g. tcp/192.168.0.1:7447#iface=eth0, for connect only if the IP address is reachable via the interface eth0
connect: {
/// timeout waiting for all endpoints connected (0: no retry, -1: infinite timeout)
/// Accepts a single value or different values for router, peer and client.
timeout_ms: { router: -1, peer: -1, client: 0 },

endpoints: [
// "<proto>/<address>"
],

/// Global connect configuration,
/// Accepts a single value or different values for router, peer and client.
/// The configuration can also be specified for the separate endpoint
/// it will override the global one
/// E.g. tcp/192.168.0.1:7447#retry_period_init_ms=20000;retry_period_max_ms=10000"

/// exit from application, if timeout exceed
exit_on_failure: { router: false, peer: false, client: true },
/// connect establishing retry configuration
retry: {
/// intial wait timeout until next connect try
period_init_ms: 1000,
/// maximum wait timeout until next connect try
period_max_ms: 4000,
/// increase factor for the next timeout until nexti connect try
period_increase_factor: 2,
},
},

/// Which endpoints to listen on. E.g. tcp/localhost:7447.
Expand All @@ -33,9 +55,31 @@
/// For TCP/UDP on Linux, it is possible additionally specify the interface to be listened to:
/// E.g. tcp/0.0.0.0:7447#iface=eth0, for listen connection only on eth0
listen: {
/// timeout waiting for all listen endpoints (0: no retry, -1: infinite timeout)
/// Accepts a single value or different values for router, peer and client.
timeout_ms: 0,

endpoints: [
// "<proto>/<address>"
],

/// Global listen configuration,
/// Accepts a single value or different values for router, peer and client.
/// The configuration can also be specified for the separate endpoint
/// it will override the global one
/// E.g. tcp/192.168.0.1:7447#exit_on_failure=false;retry_period_max_ms=1000"

/// exit from application, if timeout exceed
exit_on_failure: true,
/// listen retry configuration
retry: {
/// intial wait timeout until next try
period_init_ms: 1000,
/// maximum wait timeout until next try
period_max_ms: 4000,
/// increase factor for the next timeout until next try
period_increase_factor: 2,
},
},
/// Configure the scouting mechanisms and their behaviours
scouting: {
Expand Down
1 change: 1 addition & 0 deletions commons/zenoh-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ categories = { workspace = true }
description = "Internal crate for zenoh."

[dependencies]
log = { workspace = true }
flume = { workspace = true }
json5 = { workspace = true }
num_cpus = { workspace = true }
Expand Down
Loading

0 comments on commit 6216719

Please sign in to comment.