aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-03-28 21:23:36 +0100
committerTom Smeding <tom.smeding@gmail.com>2020-03-28 21:30:41 +0100
commitd4ba9f948f5acc5f6c22db0b5f2a1666262acc59 (patch)
tree7db005c5fdd10f3ac3dd788045c0073ef569e159 /utils
parent58dbe88ca932b4c998d8d012e88b3b5bd575edc5 (diff)
controller: Set keepalive on sockets
Diffstat (limited to 'utils')
-rw-r--r--utils/.gitignore1
-rw-r--r--utils/src/protocol.rs4
2 files changed, 3 insertions, 2 deletions
diff --git a/utils/.gitignore b/utils/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/utils/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/utils/src/protocol.rs b/utils/src/protocol.rs
index 4820f79..fce168d 100644
--- a/utils/src/protocol.rs
+++ b/utils/src/protocol.rs
@@ -23,7 +23,7 @@ pub struct RawMessage {
impl RawMessage {
pub fn receive(reader: &mut BufReader<TcpStream>) -> io::Result<Option<Self>> {
let mut header = [0u8; 17];
- if let Err(e) = reader.read(&mut header) {
+ if let Err(e) = reader.read_exact(&mut header) {
if e.kind() == ErrorKind::UnexpectedEof { return Ok(None); }
else { return Err(e); }
}
@@ -34,7 +34,7 @@ impl RawMessage {
let mut payload = Vec::new();
payload.resize(length, 0u8);
- if let Err(e) = reader.read(&mut payload) {
+ if let Err(e) = reader.read_exact(&mut payload) {
if e.kind() == ErrorKind::UnexpectedEof { return Ok(None); }
else { return Err(e); }
}