I have a custom Stream
that also has an Interval
as member that is polled when calling poll_next
on it. As I understand it the Interval
should register the callback function/Waker
of the given Context
with its underlying timer implementation which should lead to the custom stream being polled at least once every duration
, even if the stream returns Poll::Pending
every time (because the wakeup is just for internal house keeping). But apparently it doesn't.
I prepared a minimal example. This should print approximately 20 times before finishing but it only does so twice (when I ran it). Does the timeout
interfere with it? My real application also heavily relies on timeout
to keep peers from stalling during authentication, binding ressources etc., so it's not just used here to make the example bounded in time, it would be nice if it worked that way.
Do I have a fundamental misunderstanding regarding how futures work or could that be a bug?