Refactored database handling

This commit is contained in:
2021-05-18 18:44:17 +02:00
parent a89068047b
commit d25e039751
6 changed files with 58 additions and 50 deletions

View File

@ -3,8 +3,8 @@ use crate::usimp;
use crate::websocket;
use chrono;
use json;
use std::sync::{Arc, Mutex};
use std::borrow::Borrow;
use std::sync::{Arc, Mutex};
pub struct HttpStream {
pub stream: super::Stream,
@ -120,7 +120,7 @@ fn endpoint_handler(
"Unable to parse header: Content-Length missing",
client,
)
},
}
}
.parse()
{
@ -131,7 +131,7 @@ fn endpoint_handler(
format!("Unable to parse Content-Length: {}", &e).as_str(),
client,
)
},
}
};
client.stream.read_exact(&mut buf[..length]);
@ -145,7 +145,7 @@ fn endpoint_handler(
format!("Unable to parse payload: {}", &e).as_str(),
client,
)
},
}
}) {
Ok(val) => val,
Err(e) => {
@ -154,7 +154,7 @@ fn endpoint_handler(
format!("Unable to parse JSON: {}", &e).as_str(),
client,
)
},
}
};
let output = usimp::endpoint(endpoint, input);