Test the new syntax 'if let'.
authorUmmon <greg.burri@gmail.com>
Tue, 9 Dec 2014 10:24:02 +0000 (11:24 +0100)
committerUmmon <greg.burri@gmail.com>
Tue, 9 Dec 2014 10:24:02 +0000 (11:24 +0100)
lab1_rust/Cargo.lock
lab1_rust/src/end_point.rs
lab1_rust/src/packet.rs

index d718268..7f3c078 100644 (file)
@@ -8,7 +8,7 @@ dependencies = [
 [[package]]
 name = "openssl"
 version = "0.2.2"
 [[package]]
 name = "openssl"
 version = "0.2.2"
-source = "git+https://github.com/sfackler/rust-openssl.git#b8a41f79a1a78791dddd453db0aab5f0957152fc"
+source = "git+https://github.com/sfackler/rust-openssl.git#6cdd2cf577434ca3473c217e8a272ee965ef131f"
 dependencies = [
  "openssl-sys 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
 ]
 dependencies = [
  "openssl-sys 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
 ]
@@ -16,7 +16,7 @@ dependencies = [
 [[package]]
 name = "openssl-sys"
 version = "0.2.2"
 [[package]]
 name = "openssl-sys"
 version = "0.2.2"
-source = "git+https://github.com/sfackler/rust-openssl.git#b8a41f79a1a78791dddd453db0aab5f0957152fc"
+source = "git+https://github.com/sfackler/rust-openssl.git#6cdd2cf577434ca3473c217e8a272ee965ef131f"
 dependencies = [
  "pkg-config 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 dependencies = [
  "pkg-config 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
index f69f78e..97104c6 100644 (file)
@@ -299,10 +299,9 @@ impl EndPoint {
 
    fn read(&mut self) -> ReadingResult {
       fn send_error(ep: &mut EndPoint, error_type: packet::ErrorType) {
 
    fn read(&mut self) -> ReadingResult {
       fn send_error(ep: &mut EndPoint, error_type: packet::ErrorType) {
-         match ep.send(Error(error_type)) {
-            Err(e) => println!("Unable to send error packet: {}", e),
-            Ok(_) => ()
-         };
+         if let Err(e) = ep.send(Error(error_type)) {
+            println!("Unable to send error packet: {}", e)
+         }
       };
 
       self.socket.set_timeout(DEFAULT_TIMEOUT);
       };
 
       self.socket.set_timeout(DEFAULT_TIMEOUT);
index 4016ccb..7e9c38c 100644 (file)
@@ -77,12 +77,12 @@ pub enum PacketType {
 ///      0x0A: Decrypt error
 ///      0x0B: Authentication error
 ///   TTTTTTTT: Timestamp (64 bits)
 ///      0x0A: Decrypt error
 ///      0x0B: Authentication error
 ///   TTTTTTTT: Timestamp (64 bits)
-///      D...D: Encrypted data (AES-256 CBC mode) of:
-///         |I|C...C|P...P| for command and answer packet:
-///            I: Command ID
-///            C: Command payload (from 7 to 39 bytes)
-///            P: Padding from 1 to 16, |I|C...C|P...P| size must be a multiple of 16
-///         |0000000000000000| for error packet (16 bytes length)
+///   D...D: Encrypted data (AES-256 CBC mode) of:
+///      |I|C...C|P...P| for command and answer packet:
+///         I: Command ID
+///         C: Command payload (from 7 to 39 bytes)
+///         P: Padding from 1 to 16, |I|C...C|P...P| size must be a multiple of 16
+///      |0000000000000000| for error packet (16 bytes length)
 ///   MMMMMMMMMM: first 10 bytes (most significant) of the HMAC-SHA256 of:
 ///      for command and answer packet:
 ///         |I|C...C| for weak variant
 ///   MMMMMMMMMM: first 10 bytes (most significant) of the HMAC-SHA256 of:
 ///      for command and answer packet:
 ///         |I|C...C| for weak variant