Fix hearbeat
This commit is contained in:
parent
4a5f98858b
commit
3776d7bb4c
1 changed files with 7 additions and 4 deletions
|
|
@ -179,6 +179,7 @@ impl Handler {
|
||||||
frame: ClientFrames,
|
frame: ClientFrames,
|
||||||
send_message: mpsc::Sender<ServerFrames>,
|
send_message: mpsc::Sender<ServerFrames>,
|
||||||
) -> crate::Result<()> {
|
) -> crate::Result<()> {
|
||||||
|
debug!(?frame);
|
||||||
match frame {
|
match frame {
|
||||||
ClientFrames::Plate { plate, timestamp } => {
|
ClientFrames::Plate { plate, timestamp } => {
|
||||||
info!("Receive new plate {plate} {timestamp}");
|
info!("Receive new plate {plate} {timestamp}");
|
||||||
|
|
@ -201,10 +202,12 @@ impl Handler {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
ClientFrames::WantHeartbeat { interval } => {
|
ClientFrames::WantHeartbeat { interval } => {
|
||||||
tokio::spawn(async move {
|
if interval > 0 {
|
||||||
let mut heartbeat = Heartbeat::new(interval, send_message.clone());
|
tokio::spawn(async move {
|
||||||
heartbeat.start().await;
|
let mut heartbeat = Heartbeat::new(interval, send_message.clone());
|
||||||
});
|
heartbeat.start().await;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ClientFrames::IAmCamera { road, mile, limit } => {
|
ClientFrames::IAmCamera { road, mile, limit } => {
|
||||||
if self.connection_type.is_some() {
|
if self.connection_type.is_some() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue