async fn stop_heartbeat(&mut self) {
        if let Some(channel) = self.hb_channel.take() {
            let (tx, rx) = tokio::sync::oneshot::channel();
            // Take into account simultaneous heartbeat loop closure, which might happen either
            // in response to explicit service unregistration request or implicutly upon
            // heartbeat delivery failures.
            if channel
                .send(HeartbeatLoopCommand::StopHeartbeat(tx))
                .await
                .is_ok()
            {
                // Channel might have been closed straight after we have sent the message,
                // so be careful.
                if rx.await.is_err() {
                    tracing::warn!("Heartbeat loop already stopped");
                }
            }
        }
    }
/// Stop the heartbeat loop. This operation is idempotent, so it's possible to stop
/// the heartbeat loop which is already stopped.
Stop the heartbeat loop. This operation is idempotent, so it's possible to stop
the heartbeat loop which is already stopped.
Stop the heartbeat loop . This operation is idempotent so it ' s possible to stop the heartbeat loop which is already stopped .
async fn stop_heartbeat(&mut self) {
        if let Some(channel) = self.hb_channel.take() {
            let (tx, rx) = tokio::sync::oneshot::channel();
            // Take into account simultaneous heartbeat loop closure, which might happen either
            // in response to explicit service unregistration request or implicutly upon
            // heartbeat delivery failures.
            if channel
                .send(HeartbeatLoopCommand::StopHeartbeat(tx))
                .await
                .is_ok()
            {
                // Channel might have been closed straight after we have sent the message,
                // so be careful.
                if rx.await.is_err() {
                    tracing::warn!("Heartbeat loop already stopped");
                }
            }
        }
    }
async fn stop_heartbeat ( & mut self ) { if let Some ( channel ) = self . hb_channel . take ( ) { let ( tx , rx ) = tokio :: sync :: oneshot :: channel ( ) ; // Take into account simultaneous heartbeat loop closure, which might happen either // in response to explicit service unregistration request or implicutly upon // heartbeat delivery failures. if channel . send ( HeartbeatLoopCommand :: StopHeartbeat ( tx ) ) . await . is_ok ( ) { // Channel might have been closed straight after we have sent the message, // so be careful. if rx . await . is_err ( ) { tracing :: warn ! ( " " ) ; } } } }
Stop the heartbeat loop.
Stop the heartbeat loop .
&mut self
&mut self