Closed Nemo157 closed 4 years ago
Workaround for now is that it appears that recreating and polling the futures every time works (although I haven't really stress tested it)
let mut recv_from_fut = socket.recv_from(&mut buf);
let recv_from_fut = Pin::new(&mut recv_from_fut);
let (length, peer) = ready!(recv_from_fut.poll(cx))?;
(this also allows simultaneously receiving and sending from the same socket, which should be supported but is blocked by recv_from
and send_to
both taking exclusive borrows).
I want to wrap a
UdpSocket
into a type that provides higher level async APIs on top of it (specifically converting it into an application specificimpl Stream + Sink
). That would be much easier to do if it supported polling based APIs likeAsyncDatagram
rather than only providing functions that return futures.