Add ability for sync::watch::Receiver
to flag current item as unseen
#5871
Labels
A-tokio
Area: The main tokio crate
C-feature-request
Category: A feature request.
E-help-wanted
Call for participation: Help is requested to fix this issue.
M-sync
Module: tokio/sync
Is your feature request related to a problem? Please describe.
Currently there is no way for a
sync::watch::Receiver
to be created and mark the current item as unseen without notifying allReceiver
s.Describe the solution you'd like
Add a function on
Receiver
that allows the next time theReceiver
calls.has_changed()
(or similar) it returns true.Describe alternatives you've considered
Add similar function to
Sender::subscribe()
where newly createdReceiver
has a message pending andReceiver::clone()
-like method that does the same thing.Use case
sync::watch::channel()
always creates aReceiver
with a pending message.This is a very minor security concern for us because unless we hold a copy of the last seen data for every
Receiver
we are forced to re-send a bogus state change to everyReceiver
, which can then be used by the receiver client to get hints on when people are connecting and disconnecting (yes, this could be solved on a higher level, but requires a lot of needless work & memory).The text was updated successfully, but these errors were encountered: