summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2018-04-09 11:51:28 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2018-04-09 11:51:28 +0100
commitfb8984cf3376ffe28fed9938f3337655bb21d0e7 (patch)
treeb31495f12a23ccea436c9a185455c5e279e1c61f
parent2535e9adba7331e11d7e36b32dce3714c17134e0 (diff)
downloadcanopied-fb8984cf3376ffe28fed9938f3337655bb21d0e7.tar.bz2
Try clearing poll signals to improve matters
-rw-r--r--src/canstream.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/canstream.rs b/src/canstream.rs
index 1451797..630bf3d 100644
--- a/src/canstream.rs
+++ b/src/canstream.rs
@@ -94,12 +94,15 @@ impl Stream for CANStream {
return Ok(Async::NotReady);
}
+ self.socket.clear_read_ready(Ready::readable())?;
+
// Okay, we're readable, so let's have a go at reading...
let frame = match self.socket.get_ref().get_ref().read_frame() {
Ok(f) => f,
Err(e) => {
if e.should_retry() {
- return Ok(Async::NotReady);
+ trace!("Should retry...");
+ return self.poll();
} else {
warn!("Unable to cope with error: {:?}", e);
return Err(e);
@@ -143,6 +146,9 @@ impl Sink for CANStream {
if !readiness.is_writable() {
return Ok(Async::NotReady);
}
+
+ self.socket.clear_write_ready()?;
+
match self.socket
.get_ref()
.get_ref()