Fix to the new nightly.
authorUmmon <greg.burri@gmail.com>
Mon, 22 Dec 2014 12:22:33 +0000 (13:22 +0100)
committerUmmon <greg.burri@gmail.com>
Mon, 22 Dec 2014 12:22:33 +0000 (13:22 +0100)
lab1_rust/Cargo.lock
lab1_rust/src/end_point.rs
lab1_rust/src/packet.rs

index d5a58e5..00d919b 100644 (file)
@@ -2,7 +2,7 @@
 name = "lab1_rust"
 version = "0.0.2"
 dependencies = [
- "openssl 0.2.3 (git+https://github.com/sfackler/rust-openssl.git)",
+ "openssl 0.2.7 (git+https://github.com/sfackler/rust-openssl.git)",
 ]
 
 [[package]]
@@ -15,24 +15,24 @@ dependencies = [
 
 [[package]]
 name = "openssl"
-version = "0.2.3"
-source = "git+https://github.com/sfackler/rust-openssl.git#9754b8e47db5faff2930ed070527d2d71e76e094"
+version = "0.2.7"
+source = "git+https://github.com/sfackler/rust-openssl.git#12d31ade9dca8006b23e36d7631e9113f6234fc0"
 dependencies = [
- "openssl-sys 0.2.3 (git+https://github.com/sfackler/rust-openssl.git)",
+ "openssl-sys 0.2.7 (git+https://github.com/sfackler/rust-openssl.git)",
 ]
 
 [[package]]
 name = "openssl-sys"
-version = "0.2.3"
-source = "git+https://github.com/sfackler/rust-openssl.git#9754b8e47db5faff2930ed070527d2d71e76e094"
+version = "0.2.7"
+source = "git+https://github.com/sfackler/rust-openssl.git#12d31ade9dca8006b23e36d7631e9113f6234fc0"
 dependencies = [
  "libressl-pnacl-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "pkg-config"
-version = "0.1.1"
+version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
index 97104c6..d2cedcb 100644 (file)
@@ -1,6 +1,7 @@
 use std::io;
 use std::io::{ MemWriter, Acceptor, Listener, TcpStream, IoResult, IoError, EndOfFile };
 use std::io::net::tcp::{ TcpAcceptor, TcpListener };
+use std::thread::Thread;
 use packet;
 use packet::{ Packet, ReadingResult, PacketType };
 use packet::PacketType::{ Command, Answer, Error };
@@ -30,18 +31,19 @@ impl Server {
          acceptor: acceptor.clone()
       };
 
-      spawn(proc() {
+      Thread::spawn(move || {
          loop {
             for stream in acceptor.incoming() {
                match stream {
-                  Ok(stream) => spawn(proc() {
-                     Server::handle_client(EndPoint::new(stream, variant));
-                  }),
+                  Ok(stream) =>
+                     Thread::spawn(move || {
+                        Server::handle_client(EndPoint::new(stream, variant));
+                     }).detach(),
                   _ => return
                }
             }
          }
-      });
+      }).detach();
 
       Ok(server)
    }
@@ -236,7 +238,7 @@ impl Client {
 
       let mut nb_test_passed = 0;
       for (i, test) in range(1, tests.len()+1).zip(tests.iter_mut()) {
-         println!("===== Test case #{}:", i)
+         println!("===== Test case #{}:", i);
          if execute(test) {
             nb_test_passed += 1;
             println!("===== Test passed");
index ff6aa71..ec63d9e 100644 (file)
@@ -29,7 +29,7 @@ pub enum ReadingError {
 // A macro to return a 'Err(ReadingError::IO(..))' in case of error.
 macro_rules! try_read_io(
    ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(ReadingError::IO(e)) })
-)
+);
 
 // There are all the errors that may occur when encrypting, authenticating and writing a packet.
 #[deriving(Show)]
@@ -41,7 +41,7 @@ pub enum WritingError {
 // A macro to return a 'Err(WritingError::IO(..))' in case of error.
 macro_rules! try_write_io(
    ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(WritingError::IO(e)) })
-)
+);
 
 pub type ReadingResult = Result<Packet, ReadingError>;
 pub type WritingResult = Result<(), WritingError>;