Change the structure of a packet.
[crypto_lab1.git] / src / main.rs
index cec3957..fbffa21 100644 (file)
@@ -6,7 +6,7 @@ use std::io;
 use std::os;
 
 mod crypto;
-mod command;
+mod packet;
 mod client;
 mod server;
 
@@ -19,7 +19,7 @@ TODO
 const PORT: u16 = 4221;
 
 fn print_usage() {
-   println!("{} <genkey> | ...", os::args()[0]);
+   println!("{} <genkey> | <tests> | ...", os::args()[0]);
 }
 
 fn main() {   
@@ -32,7 +32,9 @@ fn main() {
          Ok(key) => println!("key: {}", key),
          Err(e) => println!("Unable to generate a key. Error: {}", e)
       }
-   } else {
+   } else {      
+      println!("Starting server.., Press any key to quit");
+      
       match server::Server::new(PORT) {
          Ok(mut server) => {
             println!("Server started");
@@ -40,7 +42,7 @@ fn main() {
             match client::Client::new("127.0.0.1", PORT) {
                Ok(mut client) => {
                   client.start_tests();
-                  client.close();
+                  let _ = client.close();
                },
                Err(e) => { 
                   println!("Unable to create a client. Error: {}", e);
@@ -48,7 +50,6 @@ fn main() {
                }
             }         
             
-            println!("Press any key to quit");
             io::stdin().read_line().ok().expect("Failed to read line");         
             server.close().ok().expect("Failed to close the server");
          },