timer: fix Handle::timeout (#1093)

The old implementation didn't work for Timeout<Stream>, since the method
took a deadline rather than a timeout.
This commit is contained in:
Steven Fackler
2019-07-08 10:18:37 -07:00
committed by Carl Lerche
parent d4803bc868
commit b62d224fac
3 changed files with 22 additions and 14 deletions
+6 -2
View File
@@ -43,8 +43,12 @@ impl Delay {
Delay { registration }
}
pub(crate) fn new_with_handle(deadline: Instant, handle: HandlePriv) -> Delay {
let mut registration = Registration::new(deadline, Duration::from_millis(0));
pub(crate) fn new_with_handle(
deadline: Instant,
duration: Duration,
handle: HandlePriv,
) -> Delay {
let mut registration = Registration::new(deadline, duration);
registration.register_with(handle);
Delay { registration }