🐛 Fix a bug in the backoff and update todo.
Video streaming and seeking is working pretty well now behind Caddy, but I'm still seeing some lag when Firefox first starts a request.main
parent
5fa0bd8584
commit
f42068db89
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
sudo docker build -t ptth .
|
|
@ -42,7 +42,7 @@ fn status_reply (c: http_serde::StatusCode, body: &str) -> http_serde::Response
|
|||
async fn handle_req_resp <'a> (
|
||||
state: &Arc <ServerState>,
|
||||
req_resp: reqwest::Response
|
||||
) {
|
||||
) -> Result <(), ()> {
|
||||
//println! ("Step 1");
|
||||
|
||||
let body = req_resp.bytes ().await.unwrap ();
|
||||
|
@ -51,7 +51,7 @@ async fn handle_req_resp <'a> (
|
|||
Ok (x) => x,
|
||||
Err (e) => {
|
||||
error! ("Can't parse wrapped requests: {:?}", e);
|
||||
return;
|
||||
return Err (());
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -118,6 +118,8 @@ async fn handle_req_resp <'a> (
|
|||
|
||||
});
|
||||
}
|
||||
|
||||
Ok (())
|
||||
}
|
||||
|
||||
#[derive (Default, Deserialize)]
|
||||
|
@ -204,10 +206,6 @@ pub async fn run_server (
|
|||
Err (e) => {
|
||||
if e.is_timeout () {
|
||||
error! ("Client-side timeout. Is an overly-aggressive firewall closing long-lived connections? Is the network flakey?");
|
||||
if backoff_delay != 0 {
|
||||
debug! ("backoff_delay = 0");
|
||||
backoff_delay = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
error! ("Err: {:?}", e);
|
||||
|
@ -219,10 +217,6 @@ pub async fn run_server (
|
|||
continue;
|
||||
},
|
||||
Ok (r) => {
|
||||
if backoff_delay != 0 {
|
||||
debug! ("backoff_delay = 0");
|
||||
backoff_delay = 0;
|
||||
}
|
||||
r
|
||||
},
|
||||
};
|
||||
|
@ -246,7 +240,15 @@ pub async fn run_server (
|
|||
// Unpack the requests, spawn them into new tasks, then loop back
|
||||
// around.
|
||||
|
||||
handle_req_resp (&state, req_resp).await;
|
||||
if handle_req_resp (&state, req_resp).await.is_err () {
|
||||
backoff_delay = err_backoff_delay;
|
||||
continue;
|
||||
}
|
||||
|
||||
if backoff_delay != 0 {
|
||||
debug! ("backoff_delay = 0");
|
||||
backoff_delay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
info! ("Exiting");
|
||||
|
|
5
todo.md
5
todo.md
|
@ -1,7 +1,6 @@
|
|||
- Not working behind Nginx
|
||||
- Try sending the http_response "OK" _after_ the request body is received
|
||||
- Not working behind Nginx (Works okay behind Caddy)
|
||||
- Still getting the slow request turtle in FF - 500-900 ms wait time
|
||||
|
||||
- Sort directory listings
|
||||
- ".." from server to server list is broken
|
||||
- Redirect to add trailing slashes
|
||||
- Add file size in directory listing
|
||||
|
|
Loading…
Reference in New Issue