Description
I am attempting to write a UdpServer which responds to packets received through UdpFramed
. however I run into difficulties when using Sink
because it is consumed upon a call by Stream::forward
when making a reply. I have tried placing the future returned by Stream::forward
to an instance variable, but it is not possible to clone (reasonably) when a call to Handler::spawn
is required as well as a new saving of the feature to the instance variable. I just want the frames to be sent and flushed at the earliest time (order is not required), but I am no longer sure what the intended way to do this is.
This problem would not be an issue on a TCP connection since each client utilizes a separate Sink
, and therefore it is sensible to send the reply before pulling more data.
Let me know if I should post a Rust playground or something. An example of the intended way to run a server like this would be helpful. I have looked at the examples, but they do not really concern my problem much at all.