summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-05-21 16:05:32 +0200
committerYorhel <git@yorhel.nl>2019-05-21 16:05:35 +0200
commite93f0dcea107b58c240c5c065bec4e2e23ef64e1 (patch)
treebeaf192b152bad8826c4eed0baea86649293a243
parentba04268c1de7a20d32fa1e37fec23bb467950a7e (diff)
httpserv: Pass a "Listener" instead of an address to run()
For more flexibility.
-rw-r--r--src/httpserv.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/httpserv.rs b/src/httpserv.rs
index 83ac82b..b374ce7 100644
--- a/src/httpserv.rs
+++ b/src/httpserv.rs
@@ -831,15 +831,7 @@ impl Server {
}
-pub fn run(listen: &(SocketAddr,Option<u32>), max_conn: usize, max_workers: usize, handler: Handler) {
- let listener = Listener::bind_reuse(&listen.0, listen.1)
- .map_err(|e| {
- error!("Unable to bind to {}: {}", listen.0, e);
- std::process::exit(1);
- }).unwrap();
-
- info!("Listening on {}", listen.0);
-
+pub fn run(listener: Listener, max_conn: usize, max_workers: usize, handler: Handler) {
let srv = Server(Arc::new(ServerImpl {
handler, max_conn, max_workers,
state: Mutex::new(ServerState {