Skip to content

Commit

Permalink
add asynchronous STATUS handling on NotifyHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaessens committed Feb 6, 2018
1 parent 757ac51 commit 6e48c77
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ impl<'a, T: Read + Write + 'a> NotifyHandle<'a, T> {
let response: Vec<u8> = self.client.run_command_and_read_response(&s)?;
parse_notify_status(&response)
}

pub fn wait(&mut self) -> Result<(String, Mailbox)> {
let mut response :Vec<u8> = Vec::new();
self.client.readline(&mut response).unwrap();
let mailboxes = parse_notify_status(&response);

// Exactly one mailbox per line
let mailbox = mailboxes.unwrap().into_iter().next().unwrap();
Ok(mailbox)
}
}

impl<'a, T: Read + Write + 'a> IdleHandle<'a, T> {
Expand Down

0 comments on commit 6e48c77

Please sign in to comment.