aboutsummaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
authorGravatar Yujia Qiao <rapiz3142@gmail.com> 2022-03-28 16:42:09 +0800
committerGravatar GitHub <noreply@github.com> 2022-03-28 16:42:09 +0800
commitfeb8c2dbfa9613deb78d683a3107c0440d0d4a1c (patch)
treeae9bd8853c7fe3531e3bdcb522d9dc3e6d25dbc8 /src/client.rs
parent636bdbd60458e9716888a560aed9d2c9f5ae4cee (diff)
downloadrathole-feb8c2dbfa9613deb78d683a3107c0440d0d4a1c.tar.gz
rathole-feb8c2dbfa9613deb78d683a3107c0440d0d4a1c.tar.zst
rathole-feb8c2dbfa9613deb78d683a3107c0440d0d4a1c.zip
fix: restart when heartbeat times out (#147)
Diffstat (limited to '')
-rw-r--r--src/client.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client.rs b/src/client.rs
index 657e666..8df8389 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -33,9 +33,11 @@ pub async fn run_client(
shutdown_rx: broadcast::Receiver<bool>,
service_rx: mpsc::Receiver<ServiceChange>,
) -> Result<()> {
- let config = config.client.ok_or_else(|| anyhow!(
+ let config = config.client.ok_or_else(|| {
+ anyhow!(
"Try to run as a client, but the configuration is missing. Please add the `[client]` block"
- ))?;
+ )
+ })?;
match config.transport.transport_type {
TransportType::Tcp => {
@@ -459,8 +461,7 @@ impl<T: 'static + Transport> ControlChannel<T> {
}
},
_ = time::sleep(Duration::from_secs(self.heartbeat_timeout)), if self.heartbeat_timeout != 0 => {
- warn!("Heartbeat timed out");
- break;
+ return Err(anyhow!("Heartbeat timed out"))
}
_ = &mut self.shutdown_rx => {
break;