This commit is contained in:
Roy Buitenhuis 2023-07-12 11:32:02 +02:00
parent b81c14f442
commit f192f44018

View File

@ -3,7 +3,7 @@
use core::cell::RefCell; use core::cell::RefCell;
use core::future::poll_fn; use core::future::poll_fn;
use core::mem; use core::mem;
use core::task::{Poll, Context}; use core::task::{Context, Poll};
use embassy_net_driver::Driver; use embassy_net_driver::Driver;
use smoltcp::iface::{Interface, SocketHandle}; use smoltcp::iface::{Interface, SocketHandle};
@ -112,7 +112,7 @@ impl<'a> UdpSocket<'a> {
/// ///
/// When a datagram is received, this method will return `Poll::Ready` with the /// When a datagram is received, this method will return `Poll::Ready` with the
/// number of bytes received and the remote endpoint. /// number of bytes received and the remote endpoint.
pub fn poll_recv_from(&self, buf: &mut[u8], cx: &mut Context<'_>) -> Poll<Result<(usize, IpEndpoint), Error>> { pub fn poll_recv_from(&self, buf: &mut [u8], cx: &mut Context<'_>) -> Poll<Result<(usize, IpEndpoint), Error>> {
self.with_mut(|s, _| match s.recv_slice(buf) { self.with_mut(|s, _| match s.recv_slice(buf) {
Ok((n, meta)) => Poll::Ready(Ok((n, meta.endpoint))), Ok((n, meta)) => Poll::Ready(Ok((n, meta.endpoint))),
// No data ready // No data ready