chiark / gitweb /
enforce tx queue expiry
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Aug 2021 22:30:05 +0000 (23:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Aug 2021 22:30:05 +0000 (23:30 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/bin/client.rs

index a1cdce4eae485c0abcd619aaa9c85cbe0ccb9418..d82496e3c428e35af9f1262273f7d20874406d10 100644 (file)
@@ -230,6 +230,15 @@ async fn run_client<C:HCC>(
           let () = y.context("write rx data to ipif")?;
         },
 
+        () = async {
+          let expires = tx_queue.front().unwrap().expires;
+          tokio::time::sleep_until(expires).await
+        },
+        if ! tx_queue.is_empty() =>
+        {
+          let _ = tx_queue.pop_front();
+        },
+
         data = tx_stream.next_segment(),
         if tx_queue.is_empty() =>
         {