feat: extra debug logging and chore: fix unused
This commit is contained in:
parent
a6b2127b0c
commit
e2d9789f9a
6 changed files with 80 additions and 47 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::error::Error;
|
||||
use std::{any::type_name_of_val, error::Error};
|
||||
|
||||
use http_body_util::{Either, Full};
|
||||
use hyper::{
|
||||
|
@ -8,7 +8,7 @@ use hyper::{
|
|||
service::{HttpService, Service},
|
||||
};
|
||||
use hyper_util::rt::TokioIo;
|
||||
use log::error;
|
||||
use log::{error, info};
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
|
||||
pub type GeneralResponse = Response<GeneralBody>;
|
||||
|
@ -39,6 +39,12 @@ where
|
|||
<S as HttpService<Incoming>>::Future: Send,
|
||||
{
|
||||
pub async fn handle(&self) {
|
||||
info!(
|
||||
"Server started at http://{} for service: {}",
|
||||
self.listener.local_addr().unwrap(),
|
||||
type_name_of_val(&self.service)
|
||||
);
|
||||
|
||||
loop {
|
||||
let (stream, _) = self.listener.accept().await.unwrap();
|
||||
|
||||
|
@ -46,6 +52,7 @@ where
|
|||
svc_clone.stream(&stream);
|
||||
|
||||
let io = TokioIo::new(stream);
|
||||
|
||||
tokio::task::spawn(async move {
|
||||
if let Err(err) = http1::Builder::new()
|
||||
.writev(false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue