mirror of https://github.com/rapiz1/rathole.git
fix: restart when heartbeat times out (#147)
This commit is contained in:
parent
636bdbd604
commit
feb8c2dbfa
|
@ -33,9 +33,11 @@ pub async fn run_client(
|
||||||
shutdown_rx: broadcast::Receiver<bool>,
|
shutdown_rx: broadcast::Receiver<bool>,
|
||||||
service_rx: mpsc::Receiver<ServiceChange>,
|
service_rx: mpsc::Receiver<ServiceChange>,
|
||||||
) -> Result<()> {
|
) -> 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"
|
"Try to run as a client, but the configuration is missing. Please add the `[client]` block"
|
||||||
))?;
|
)
|
||||||
|
})?;
|
||||||
|
|
||||||
match config.transport.transport_type {
|
match config.transport.transport_type {
|
||||||
TransportType::Tcp => {
|
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 => {
|
_ = time::sleep(Duration::from_secs(self.heartbeat_timeout)), if self.heartbeat_timeout != 0 => {
|
||||||
warn!("Heartbeat timed out");
|
return Err(anyhow!("Heartbeat timed out"))
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
_ = &mut self.shutdown_rx => {
|
_ = &mut self.shutdown_rx => {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue