udp: UdpSocket split support (#1226)

This commit is contained in:
Yin Guanhao
2019-07-08 14:47:31 -07:00
committed by Carl Lerche
parent 8b49a1e05f
commit 88e775dcf0
9 changed files with 247 additions and 13 deletions
+3 -3
View File
@@ -11,13 +11,13 @@ use std::task::{Context, Poll};
#[must_use = "futures do nothing unless polled"]
#[derive(Debug)]
pub struct SendTo<'a, 'b> {
socket: &'a mut UdpSocket,
socket: &'a UdpSocket,
buf: &'b [u8],
target: &'b SocketAddr,
}
impl<'a, 'b> SendTo<'a, 'b> {
pub(super) fn new(socket: &'a mut UdpSocket, buf: &'b [u8], target: &'b SocketAddr) -> Self {
pub(super) fn new(socket: &'a UdpSocket, buf: &'b [u8], target: &'b SocketAddr) -> Self {
Self {
socket,
buf,
@@ -35,6 +35,6 @@ impl<'a, 'b> Future for SendTo<'a, 'b> {
buf,
target,
} = self.get_mut();
Pin::new(&mut **socket).poll_send_to(cx, buf, target)
socket.poll_send_to_priv(cx, buf, target)
}
}