aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2021-01-04 18:24:38 +0100
committerMax Audron <audron@cocaine.farm>2021-01-04 18:24:38 +0100
commit0f26b1bad20ce68efa0c9296143f3176e93977b6 (patch)
treeb85076187e24d6b012bcb1e682677278c4a3cbb9
parentadd more signalproxy objects (diff)
random stuff
Diffstat (limited to '')
-rw-r--r--.gitignore1
-rw-r--r--rustfmt.toml1
-rw-r--r--src/message/handshake/init.rs1
-rw-r--r--src/primitive/string.rs7
-rw-r--r--src/primitive/variantlist.rs1
5 files changed, 9 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index aa085cd..0986dc1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
Cargo.lock
/target
**/*.rs.bk
+examples/testserver
diff --git a/rustfmt.toml b/rustfmt.toml
new file mode 100644
index 0000000..32a9786
--- /dev/null
+++ b/rustfmt.toml
@@ -0,0 +1 @@
+edition = "2018"
diff --git a/src/message/handshake/init.rs b/src/message/handshake/init.rs
index 860df8a..b4604b6 100644
--- a/src/message/handshake/init.rs
+++ b/src/message/handshake/init.rs
@@ -2,6 +2,7 @@ use crate::Deserialize;
use crate::Serialize;
/// The first few bytes sent to the core to initialize the connection and setup if we want to use tls and compression
+#[derive(Clone, Debug)]
pub struct Init {
pub tls: bool,
pub compression: bool,
diff --git a/src/primitive/string.rs b/src/primitive/string.rs
index 86bcdec..dcd4f7c 100644
--- a/src/primitive/string.rs
+++ b/src/primitive/string.rs
@@ -7,8 +7,8 @@ use failure::Error;
use log::trace;
-use crate::{Deserialize, DeserializeUTF8, Serialize, SerializeUTF8};
use crate::util;
+use crate::{Deserialize, DeserializeUTF8, Serialize, SerializeUTF8};
/// We Shadow the String type here as we can only use impl on types in our own scope.
///
@@ -33,7 +33,6 @@ impl SerializeUTF8 for String {
fn serialize_utf8(&self) -> Result<Vec<u8>, Error> {
let mut res: Vec<u8> = Vec::new();
res.extend(self.clone().into_bytes());
- res.extend(vec![0x00]);
util::prepend_byte_len(&mut res);
return Ok(res);
}
@@ -64,6 +63,7 @@ impl Deserialize for String {
}
let res: String = String::from_utf16(&chars).unwrap();
+ trace!("parsed string: {}", res);
return Ok((pos, res));
}
}
@@ -81,6 +81,7 @@ impl DeserializeUTF8 for String {
let ulen = len as usize;
let mut res: String = String::from_utf8(b[4..(ulen + 4)].to_vec())?;
+ trace!("parsed string: {}", res);
// If the last byte is zero remove it
// Receiving a string as bytearray will sometimes have
@@ -89,6 +90,8 @@ impl DeserializeUTF8 for String {
let _ = res.pop();
}
+ trace!("parsed string after trunc: {}", res);
+
return Ok((ulen + 4, res));
}
}
diff --git a/src/primitive/variantlist.rs b/src/primitive/variantlist.rs
index 452b927..a802864 100644
--- a/src/primitive/variantlist.rs
+++ b/src/primitive/variantlist.rs
@@ -40,6 +40,7 @@ impl Deserialize for VariantList {
for i in 0..len {
trace!(target: "primitive::VariantList", "Parsing VariantList element: {:?}", i);
let (vlen, val) = Variant::parse(&b[pos..])?;
+ trace!("parsed variant: {:?}", val);
res.push(val);
pos += vlen;
}