🚧 Can I test these within the same process?

main
_ 2020-10-30 17:53:03 -05:00
parent 07686e693c
commit 8d3fc71dcf
2 changed files with 12 additions and 4 deletions

View File

@ -244,8 +244,7 @@ async fn handle_all (req: Request <Body>, state: Arc <ServerState>)
} }
} }
#[tokio::main] async fn relay_main () -> Result <(), Box <dyn Error>> {
async fn main () -> Result <(), Box <dyn Error>> {
let addr = SocketAddr::from(([0, 0, 0, 0], 4000)); let addr = SocketAddr::from(([0, 0, 0, 0], 4000));
let state = Arc::new (ServerState::default ()); let state = Arc::new (ServerState::default ());
@ -268,3 +267,8 @@ async fn main () -> Result <(), Box <dyn Error>> {
Ok (()) Ok (())
} }
#[tokio::main]
async fn main () -> Result <(), Box <dyn Error>> {
relay_main ().await
}

View File

@ -55,8 +55,7 @@ async fn handle_req_resp (
Ok (()) Ok (())
} }
#[tokio::main] async fn server_main () -> Result <(), Box <dyn Error>> {
async fn main () -> Result <(), Box <dyn Error>> {
let client = Arc::new (Client::new ()); let client = Arc::new (Client::new ());
let mut backoff_delay = 0; let mut backoff_delay = 0;
@ -91,3 +90,8 @@ async fn main () -> Result <(), Box <dyn Error>> {
}); });
} }
} }
#[tokio::main]
async fn main () -> Result <(), Box <dyn Error>> {
server_main ().await
}