Fixed serve command failure caused by tokio-related issue (#1183)
This commit is contained in:
parent
664cb14ffd
commit
ada6710c99
|
@ -26,6 +26,7 @@ use std::path::{Path, PathBuf};
|
|||
use std::sync::mpsc::channel;
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::net::{SocketAddrV4, TcpListener};
|
||||
|
||||
use hyper::header;
|
||||
use hyper::service::{make_service_fn, service_fn};
|
||||
|
@ -184,7 +185,8 @@ fn create_new_site(
|
|||
let address = format!("{}:{}", interface, interface_port);
|
||||
|
||||
// Stop right there if we can't bind to the address
|
||||
if Server::try_bind(&address.parse().unwrap()).is_err() {
|
||||
let bind_address: SocketAddrV4 = address.parse().unwrap();
|
||||
if (TcpListener::bind(&bind_address)).is_err() {
|
||||
return Err(format!("Cannot start server on address {}.", address))?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue