From b15b5e524695383b6b3ccee8f9e1fa0e822640e4 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 16 Mar 2018 11:17:27 -0700 Subject: [PATCH] check number of available workers --- src/server/srv.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/srv.rs b/src/server/srv.rs index 836c6395..f24e3b97 100644 --- a/src/server/srv.rs +++ b/src/server/srv.rs @@ -744,6 +744,11 @@ fn start_accept_thread( workers[next].0, info.clone())); msg = err.into_inner(); workers.swap_remove(next); + if workers.is_empty() { + break + } else if workers.len() <= next { + next = 0; + } continue } }