Feature/max retry (#409)
* Maximum number of allowed reconnection attempts * Requiring initial internode connection to be successful * Decreased logging level for failing to establish initial connection
This commit is contained in:
committed by
GitHub
parent
d7985ef05d
commit
72496ad2aa
@@ -40,6 +40,7 @@ const DEFAULT_PACKET_FORWARDING_INITIAL_BACKOFF: Duration = Duration::from_milli
|
||||
const DEFAULT_PACKET_FORWARDING_MAXIMUM_BACKOFF: Duration = Duration::from_millis(300_000);
|
||||
const DEFAULT_INITIAL_CONNECTION_TIMEOUT: Duration = Duration::from_millis(1_500);
|
||||
const DEFAULT_CACHE_ENTRY_TTL: Duration = Duration::from_millis(30_000);
|
||||
const DEFAULT_MAXIMUM_RECONNECTION_ATTEMPTS: u32 = 20;
|
||||
|
||||
#[derive(Debug, Default, Deserialize, PartialEq, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@@ -330,6 +331,10 @@ impl Config {
|
||||
self.debug.initial_connection_timeout
|
||||
}
|
||||
|
||||
pub fn get_packet_forwarding_max_reconnections(&self) -> u32 {
|
||||
self.debug.maximum_reconnection_attempts
|
||||
}
|
||||
|
||||
pub fn get_cache_entry_ttl(&self) -> Duration {
|
||||
self.debug.cache_entry_ttl
|
||||
}
|
||||
@@ -490,6 +495,10 @@ pub struct Debug {
|
||||
)]
|
||||
initial_connection_timeout: Duration,
|
||||
|
||||
/// Maximum number of retries node is going to attempt to re-establish existing connection
|
||||
/// to another node when forwarding sphinx packets.
|
||||
maximum_reconnection_attempts: u32,
|
||||
|
||||
/// Duration for which a cached vpn processing result is going to get stored for.
|
||||
#[serde(
|
||||
deserialize_with = "deserialize_duration",
|
||||
@@ -505,6 +514,7 @@ impl Default for Debug {
|
||||
packet_forwarding_initial_backoff: DEFAULT_PACKET_FORWARDING_INITIAL_BACKOFF,
|
||||
packet_forwarding_maximum_backoff: DEFAULT_PACKET_FORWARDING_MAXIMUM_BACKOFF,
|
||||
initial_connection_timeout: DEFAULT_INITIAL_CONNECTION_TIMEOUT,
|
||||
maximum_reconnection_attempts: DEFAULT_MAXIMUM_RECONNECTION_ATTEMPTS,
|
||||
cache_entry_ttl: DEFAULT_CACHE_ENTRY_TTL,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ impl MixNode {
|
||||
self.config.get_packet_forwarding_initial_backoff(),
|
||||
self.config.get_packet_forwarding_maximum_backoff(),
|
||||
self.config.get_initial_connection_timeout(),
|
||||
self.config.get_packet_forwarding_max_reconnections(),
|
||||
);
|
||||
|
||||
tokio::spawn(async move { packet_forwarder.run().await });
|
||||
|
||||
Reference in New Issue
Block a user