From bf021bb47559c475557f40e01b7265cf2bad4db0 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 19 Sep 2015 11:02:10 -0700 Subject: [PATCH] Move desync check back a bit --- src/notification.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/notification.rs b/src/notification.rs index be026381..cfb8b28f 100644 --- a/src/notification.rs +++ b/src/notification.rs @@ -99,14 +99,15 @@ impl<'a> Iterator for BlockingIter<'a> { fn next(&mut self) -> Option> { let mut conn = self.conn.conn.borrow_mut(); - if conn.is_desynchronized() { - return Some(Err(Error::IoError(desynchronized()))); - } if let Some(notification) = conn.notifications.pop_front() { return Some(Ok(notification)); } + if conn.is_desynchronized() { + return Some(Err(Error::IoError(desynchronized()))); + } + match conn.read_message_with_notification() { Ok(NotificationResponse { pid, channel, payload }) => { Some(Ok(Notification {