From 492b31ffd13d4def86050d1db31c5c2e59b670ab Mon Sep 17 00:00:00 2001 From: tom barrett Date: Wed, 21 Feb 2018 08:47:21 -0600 Subject: -moving engines shows change on dashboard --- src/bin/server.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/bin') diff --git a/src/bin/server.rs b/src/bin/server.rs index 871315e..7c6a63e 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -9,19 +9,20 @@ fn main() { let listener = TcpListener::bind("localhost:6000").unwrap(); listener.set_nonblocking(true).unwrap(); + let mut ships = Vec::new(); + let mut connections = Vec::new(); for stream in listener.incoming() { match stream { - Ok(stream) => connections.push(Connection::new(stream)), + Ok(stream) => connections.push(Connection::new(stream, &mut ships)), _ => { - println!("looped"); for i in 0..connections.len() { - connections[i].process(); + connections[i].process(&mut ships); } connections.retain(|connection| connection.open ); + sleep(Duration::from_millis(100)); } } } - } -- cgit v1.2.3