🐛 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> (
|
async fn handle_req_resp <'a> (
|
||||||
state: &Arc <ServerState>,
|
state: &Arc <ServerState>,
|
||||||
req_resp: reqwest::Response
|
req_resp: reqwest::Response
|
||||||
) {
|
) -> Result <(), ()> {
|
||||||
//println! ("Step 1");
|
//println! ("Step 1");
|
||||||
|
|
||||||
let body = req_resp.bytes ().await.unwrap ();
|
let body = req_resp.bytes ().await.unwrap ();
|
||||||
|
@ -51,7 +51,7 @@ async fn handle_req_resp <'a> (
|
||||||
Ok (x) => x,
|
Ok (x) => x,
|
||||||
Err (e) => {
|
Err (e) => {
|
||||||
error! ("Can't parse wrapped requests: {:?}", 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)]
|
#[derive (Default, Deserialize)]
|
||||||
|
@ -204,10 +206,6 @@ pub async fn run_server (
|
||||||
Err (e) => {
|
Err (e) => {
|
||||||
if e.is_timeout () {
|
if e.is_timeout () {
|
||||||
error! ("Client-side timeout. Is an overly-aggressive firewall closing long-lived connections? Is the network flakey?");
|
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 {
|
else {
|
||||||
error! ("Err: {:?}", e);
|
error! ("Err: {:?}", e);
|
||||||
|
@ -219,10 +217,6 @@ pub async fn run_server (
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
Ok (r) => {
|
Ok (r) => {
|
||||||
if backoff_delay != 0 {
|
|
||||||
debug! ("backoff_delay = 0");
|
|
||||||
backoff_delay = 0;
|
|
||||||
}
|
|
||||||
r
|
r
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -246,7 +240,15 @@ pub async fn run_server (
|
||||||
// Unpack the requests, spawn them into new tasks, then loop back
|
// Unpack the requests, spawn them into new tasks, then loop back
|
||||||
// around.
|
// 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");
|
info! ("Exiting");
|
||||||
|
|
5
todo.md
5
todo.md
|
@ -1,7 +1,6 @@
|
||||||
- Not working behind Nginx
|
- Not working behind Nginx (Works okay behind Caddy)
|
||||||
- Try sending the http_response "OK" _after_ the request body is received
|
- Still getting the slow request turtle in FF - 500-900 ms wait time
|
||||||
|
|
||||||
- Sort directory listings
|
|
||||||
- ".." from server to server list is broken
|
- ".." from server to server list is broken
|
||||||
- Redirect to add trailing slashes
|
- Redirect to add trailing slashes
|
||||||
- Add file size in directory listing
|
- Add file size in directory listing
|
||||||
|
|
Loading…
Reference in New Issue