mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 22:02:36 +00:00
errors on failure to bind address
This commit is contained in:
1 parent
a163045e99
commit
ff2ca85a7f
4 files changed
+24
-4
No files matched your search
@@ -58,7 +58,12 @@ pub fn run_http_server(args: CreateServerArgs) -> AnyhowResult<Server> {
|
||||
.route(web::head().to(|| HttpResponse::Ok())),
|
||||
)
|
||||
})
|
||||
.bind(bind_address)?
|
||||
.bind(&bind_address)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("FATAL: Failed to bind to address '{}': {}", bind_address, err);
|
||||
eprintln!("The address is likely already in use by another process.");
|
||||
std::process::exit(1);
|
||||
})
|
||||
.workers(num_workers)
|
||||
.run();
|
||||
|
||||
|
||||
@@ -58,7 +58,12 @@ pub fn run_http_server(args: CreateServerArgs) -> AnyhowResult<Server> {
|
||||
.route(web::head().to(|| HttpResponse::Ok())),
|
||||
)
|
||||
})
|
||||
.bind(bind_address)?
|
||||
.bind(&bind_address)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("FATAL: Failed to bind to address '{}': {}", bind_address, err);
|
||||
eprintln!("The address is likely already in use by another process.");
|
||||
std::process::exit(1);
|
||||
})
|
||||
.workers(num_workers)
|
||||
.run();
|
||||
|
||||
|
||||
@@ -48,6 +48,11 @@ async fn main() -> Result<(), impl Error> {
|
||||
.url("/api-docs/openapi.json", ApiDoc::openapi()),
|
||||
)
|
||||
})
|
||||
.bind(("localhost", 8989)).unwrap()
|
||||
.bind(("localhost", 8989))
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("FATAL: Failed to bind docs server to localhost:8989: {}", err);
|
||||
eprintln!("The address is likely already in use by another process.");
|
||||
std::process::exit(1);
|
||||
})
|
||||
.run().await
|
||||
}
|
||||
@@ -713,7 +713,12 @@ pub async fn serve(server_state: ServerState) -> AnyhowResult<()>
|
||||
|
||||
add_routes(app, old_server_environment)
|
||||
})
|
||||
.bind(bind_address)?
|
||||
.bind(&bind_address)
|
||||
.unwrap_or_else(|err| {
|
||||
eprintln!("FATAL: Failed to bind to address '{}': {}", bind_address, err);
|
||||
eprintln!("The address is likely already in use by another process.");
|
||||
std::process::exit(1);
|
||||
})
|
||||
.workers(num_workers)
|
||||
.run()
|
||||
.await?;
|
||||
|
||||
Reference in new issue
Block a user