Update futures-curl

Also involved yet another round of bug fixes to the timer wheel as well as an
unfortunately serious rejiggering of the level-translation into libcurl. Eew.
This commit is contained in:
Alex Crichton
2016-08-17 18:41:34 -07:00
parent 311bfa07a3
commit 8025d85019
3 changed files with 74 additions and 22 deletions
+4 -3
View File
@@ -15,7 +15,6 @@ use event_loop::TimeoutToken;
/// they will likely fire some granularity after the exact instant that they're
/// otherwise indicated to fire at.
pub struct Timeout {
at: Instant,
token: TimeoutToken,
handle: LoopHandle,
}
@@ -38,7 +37,6 @@ impl LoopHandle {
pub fn timeout_at(self, at: Instant) -> IoFuture<Timeout> {
self.add_timeout(at).map(move |token| {
Timeout {
at: at,
token: token,
handle: self,
}
@@ -52,9 +50,12 @@ impl Future for Timeout {
fn poll(&mut self) -> Poll<(), io::Error> {
// TODO: is this fast enough?
if self.at <= Instant::now() {
let now = Instant::now();
if *self.token.when() <= now {
Poll::Ok(())
} else {
trace!("waiting for a timeout at {:?}", self.token.when());
trace!("current time is {:?}", now);
self.handle.update_timeout(&self.token);
Poll::NotReady
}