Skip to content

Commit

Permalink
refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Apr 15, 2024
1 parent a6d9f28 commit 3218eeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bin/overtls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async fn async_main(config: Config) -> Result<()> {
.await;

if let Err(e) = main_body.await {
log::error!("{}", e);
log::error!("main_body error: \"{}\"", e);
}

Ok(())
Expand Down
8 changes: 7 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ pub async fn run_server(config: &Config, exiting_flag: crate::CancellationToken)

let traffic_audit = Arc::new(Mutex::new(TrafficAudit::new()));

let listener = TcpListener::bind(&addr).await?;
let listener = match TcpListener::bind(&addr).await {
Ok(listener) => listener,
Err(e) => {
log::error!("failed to bind to {} in file {} at line {}: \"{}\"", addr, file!(), line!(), e);
return Err(e.into());
}
};

loop {
tokio::select! {
Expand Down

0 comments on commit 3218eeb

Please sign in to comment.