From be603944b53094bc97df9888f7e6d8e365cb7f45 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Fri, 13 May 2022 16:08:24 +1000 Subject: [PATCH 1/2] Cleanup weird heartbeat_interval code The `maker_heartbeat` interval should be the actual interval and not double of it when we use it in the actor. --- daemon/src/lib.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs index dde194684..f1d7ae3ae 100644 --- a/daemon/src/lib.rs +++ b/daemon/src/lib.rs @@ -175,11 +175,6 @@ where .create(None) .spawn(&mut tasks); - // Timeout happens when taker did not receive two consecutive heartbeats - let taker_heartbeat_timeout = maker_heartbeat_interval - .checked_mul(2) - .expect("not to overflow"); - tasks.add( connection_actor_ctx .with_handler_timeout(Duration::from_secs(120)) @@ -187,7 +182,7 @@ where maker_online_status_feed_sender, &cfd_actor_addr, identity.identity_sk, - taker_heartbeat_timeout, + maker_heartbeat_interval, connect_timeout, )), ); From 158bf392518696b2a0c5ac7e890474c6ceae229e Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Fri, 13 May 2022 16:09:06 +1000 Subject: [PATCH 2/2] Taker allows three minutes until reconnect Taker reconnects only when heartbeat is missed for more than three minutes. --- daemon/src/connection.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/src/connection.rs b/daemon/src/connection.rs index 84994376f..61d537d65 100644 --- a/daemon/src/connection.rs +++ b/daemon/src/connection.rs @@ -236,7 +236,7 @@ impl Actor { heartbeat_measuring_rate: maker_heartbeat_interval.checked_div(2).expect("to divide"), maker_heartbeat_interval, heartbeat_timeout: maker_heartbeat_interval - .checked_mul(2) + .checked_mul(36) .expect("to not overflow"), state: State::Disconnected, setup_actors: AddressMap::default(),