diff options
author | tom barrett <spalf0@gmail.com> | 2018-02-21 08:47:21 -0600 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2018-02-21 08:47:21 -0600 |
commit | 492b31ffd13d4def86050d1db31c5c2e59b670ab (patch) | |
tree | 915f4243497dcc3a19148e745922285364e5ad8a /src/bin | |
parent | d42a28c46057c386d161bfe438302e2314f0a6f6 (diff) |
-moving engines shows change on dashboard
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/server.rs | 9 |
1 files changed, 5 insertions, 4 deletions
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)); } } } - } |