clean up mux server startup
kindof a lot going on in this commit, unintentionally: * Need the lua context set to be moved into the config crate otherwise configs cannot be parsed by the server and we end up with the default configs * Make the server use smol for async io * Drop the use of the daemonize crate, which I had forked anyway. Just inline our own tighter daemonize module * Improve daemon spawning synchronization, however, it still needs work for windows to avoid blocking forever where we don't do daemonizing.
This commit is contained in:
1 parent
a4731fd5ab
commit
e8be716cb3
19 files changed
+656
-568
No files matched your search
+28
-2
@@ -158,7 +158,20 @@ async fn decode_raw_async<R: Unpin + AsyncReadExt>(r: &mut R) -> anyhow::Result<
|
||||
};
|
||||
let serial = read_u64_async(r).await.context("reading PDU serial")?;
|
||||
let ident = read_u64_async(r).await.context("reading PDU ident")?;
|
||||
let data_len = len as usize - (encoded_length(ident) + encoded_length(serial));
|
||||
let data_len =
|
||||
match (len as usize).overflowing_sub(encoded_length(ident) + encoded_length(serial)) {
|
||||
(_, true) => {
|
||||
anyhow::bail!(
|
||||
"sizes don't make sense: len:{} serial:{} (enc={}) ident:{} (enc={})",
|
||||
len,
|
||||
serial,
|
||||
encoded_length(serial),
|
||||
ident,
|
||||
encoded_length(ident)
|
||||
);
|
||||
}
|
||||
(data_len, false) => data_len,
|
||||
};
|
||||
|
||||
if is_compressed {
|
||||
metrics::value!("pdu.decode.compressed.size", data_len as u64);
|
||||
@@ -192,7 +205,20 @@ fn decode_raw<R: std::io::Read>(mut r: R) -> anyhow::Result<Decoded> {
|
||||
};
|
||||
let serial = read_u64(r.by_ref()).context("reading PDU serial")?;
|
||||
let ident = read_u64(r.by_ref()).context("reading PDU ident")?;
|
||||
let data_len = len as usize - (encoded_length(ident) + encoded_length(serial));
|
||||
let data_len =
|
||||
match (len as usize).overflowing_sub(encoded_length(ident) + encoded_length(serial)) {
|
||||
(_, true) => {
|
||||
anyhow::bail!(
|
||||
"sizes don't make sense: len:{} serial:{} (enc={}) ident:{} (enc={})",
|
||||
len,
|
||||
serial,
|
||||
encoded_length(serial),
|
||||
ident,
|
||||
encoded_length(ident)
|
||||
);
|
||||
}
|
||||
(data_len, false) => data_len,
|
||||
};
|
||||
|
||||
if is_compressed {
|
||||
metrics::value!("pdu.decode.compressed.size", data_len as u64);
|
||||
|
||||
Reference in new issue
Block a user