Clarify error when unable to parse listen address
This commit is contained in:
parent
d031061c41
commit
a22ca95d3d
1 changed files with 5 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
use anyhow::Result;
|
use anyhow::{Context, Result};
|
||||||
use futures::stream::{FuturesUnordered, StreamExt};
|
use futures::stream::{FuturesUnordered, StreamExt};
|
||||||
use std::net::ToSocketAddrs;
|
use std::net::ToSocketAddrs;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
@ -25,7 +25,10 @@ async fn main() -> Result<()> {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
let addrs = args.listen.to_socket_addrs()?;
|
let addrs = args
|
||||||
|
.listen
|
||||||
|
.to_socket_addrs()
|
||||||
|
.context("Couldn't parse the listen address")?;
|
||||||
let servers = FuturesUnordered::new();
|
let servers = FuturesUnordered::new();
|
||||||
for addr in addrs {
|
for addr in addrs {
|
||||||
let (_, server) = serve(socket_handler).try_bind_ephemeral(addr)?;
|
let (_, server) = serve(socket_handler).try_bind_ephemeral(addr)?;
|
||||||
|
|
Loading…
Reference in a new issue