Fixed serve command failure caused by tokio-related issue (#1183)

This commit is contained in:
Vladislav Nikonov 2020-09-25 12:01:14 +03:00 committed by GitHub
parent 664cb14ffd
commit ada6710c99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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))?;
}