This commit is contained in:
Frank Denis 2018-02-06 02:00:06 +01:00
parent 63adc48af5
commit d0dc5d45e3

View file

@ -112,14 +112,14 @@ fn main() {
let timers = tokio_timer::wheel().build(); let timers = tokio_timer::wheel().build();
let client_count = Rc::new(RefCell::new(0u32)); let client_count = Rc::new(RefCell::new(0u32));
let fut = server.for_each(move |client_fut| { let fut = server.for_each(move |client_fut| {
let client_count_inner = client_count.clone();
{ {
let count = client_count_inner.borrow_mut(); let count = client_count.borrow_mut();
if *count > MAX_CLIENTS { if *count > MAX_CLIENTS {
return Ok(()); return Ok(());
} }
(*count).saturating_add(1); (*count).saturating_add(1);
} }
let client_count_inner = client_count.clone();
let timers_inner = timers.clone(); let timers_inner = timers.clone();
let fut = client_fut let fut = client_fut
.map(move |_| { .map(move |_| {