allow ping before RemAck

This commit is contained in:
soruh 2023-03-20 15:46:34 +01:00
parent a5c73993d3
commit 6f1e9836c0

View File

@ -346,8 +346,11 @@ pub async fn handler(
return Ok(()); return Ok(());
}; };
let notify_at = Instant::now();
loop {
let recv = timeout( let recv = timeout(
CALL_ACK_TIMEOUT, CALL_ACK_TIMEOUT.saturating_sub(notify_at.elapsed()),
packet.recv_into_cancelation_safe(&mut reader), packet.recv_into_cancelation_safe(&mut reader),
); );
@ -358,6 +361,7 @@ pub async fn handler(
res?; res?;
match packet.kind() { match packet.kind() {
PacketKind::Ping => {}
PacketKind::End | PacketKind::Reject => { PacketKind::End | PacketKind::Reject => {
port_handler.lock().await.start_rejector( port_handler.lock().await.start_rejector(
port, port,
@ -368,7 +372,7 @@ pub async fn handler(
packet, packet,
); );
Ok(()) return Ok(());
} }
PacketKind::RemAck => { PacketKind::RemAck => {
@ -380,9 +384,12 @@ pub async fn handler(
client, client,
&mut caller, &mut caller,
) )
.await .await?;
return Ok(());
} }
kind => Err(eyre!("unexpected packet: {:?}", kind)), kind => return Err(eyre!("unexpected packet: {:?}", kind)),
}
} }
} }