IrcTransport::poll_complete now polls the ping timer (fixes #115).
This commit is contained in:
parent
decfd0b9bc
commit
e847cda40a
1 changed files with 10 additions and 6 deletions
|
@ -108,13 +108,10 @@ where
|
|||
}
|
||||
(Async::Ready(None), _) => Ok(Async::Ready(None)),
|
||||
(Async::Ready(Some(msg)), _) => {
|
||||
match timer_poll {
|
||||
Async::Ready(msg) => {
|
||||
if let Async::Ready(msg) = timer_poll {
|
||||
assert!(msg.is_some());
|
||||
self.send_ping()?;
|
||||
}
|
||||
Async::NotReady => (),
|
||||
}
|
||||
|
||||
match msg.command {
|
||||
// Automatically respond to PINGs from the server.
|
||||
|
@ -182,6 +179,13 @@ where
|
|||
self.close()?;
|
||||
Err(error::IrcError::PingTimeout)
|
||||
} else {
|
||||
// If it's time to send a ping, we should do it! This is necessary to ensure that the
|
||||
// sink half will close even if the stream half closed without a ping timeout.
|
||||
if let Async::Ready(msg) = self.ping_timer.poll()? {
|
||||
assert!(msg.is_some());
|
||||
self.send_ping()?;
|
||||
}
|
||||
|
||||
Ok(self.inner.poll_complete()?)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue