summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/server.rs9
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));
}
}
}
-
}