chiark / gitweb /
wip, fixes, still no early return apparently
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Aug 2021 17:16:55 +0000 (18:16 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Aug 2021 17:17:06 +0000 (18:17 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
server/suser.rs

index 69bbf877bf49829ce7c8520f0cb27b2ffae2c142..cd3210560fd4309b4c186cb508f21a5b4eda6195 100644 (file)
@@ -51,11 +51,16 @@ pub async fn run(global: Arc<Global>,
       .sat();
 
     if let Some(req) = {
+      let now = Instant::now();
+
       if ! downbound.is_empty() {
         outstanding.pop_front()
       } else if let Some((i,_)) = outstanding.iter().enumerate().find({
-        |(_,o)| outstanding.len() > o.oi.target_requests_outstanding.sat()
-        // xxx need timeout-based return too
+        |(_,o)| {
+          outstanding.len() > o.oi.target_requests_outstanding.sat()
+            ||
+          o.oi.deadline < now
+        }
       }) {
         Some(outstanding.remove(i).unwrap())
       } else {
@@ -91,6 +96,7 @@ pub async fn run(global: Arc<Global>,
 
     while downbound.total_len() > max {
       let _ = downbound.pop_front();
+      trace!("{} discarding downbound-queue-full", &ic.link);
     }
 
     select!{