From ada6710c990d603ba4fd0b9e2c642fa084277507 Mon Sep 17 00:00:00 2001 From: Vladislav Nikonov Date: Fri, 25 Sep 2020 12:01:14 +0300 Subject: [PATCH] Fixed serve command failure caused by tokio-related issue (#1183) --- src/cmd/serve.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index 58ea99b5..83d2dd7b 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -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))?; }