Skip to content

Commit

Permalink
fix: correct recv_from_with_flags and sendto (#81)
Browse files Browse the repository at this point in the history
The behavior is wrong with original function. Fix with simple lines.
  • Loading branch information
PerfectLaugh committed May 21, 2020
1 parent 2e337a0 commit b3badc7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,12 @@ impl Socket {
/// `recvfrom` call.
///
/// [`recv_from`]: #method.recv_from
pub fn recv_from_with_flags(&self, buf: &mut [u8], flags: i32) -> io::Result<usize> {
self.inner.recv(buf, flags)
pub fn recv_from_with_flags(
&self,
buf: &mut [u8],
flags: i32,
) -> io::Result<(usize, SockAddr)> {
self.inner.recv_from(buf, flags)
}

/// Receives data from the socket, without removing it from the queue.
Expand Down Expand Up @@ -343,8 +347,8 @@ impl Socket {
/// `sendto` call.
///
/// [`send_to`]: #method.send_to
pub fn send_to_with_flags(&self, buf: &mut [u8], flags: i32) -> io::Result<usize> {
self.inner.recv(buf, flags)
pub fn send_to_with_flags(&self, buf: &[u8], addr: &SockAddr, flags: i32) -> io::Result<usize> {
self.inner.send_to(buf, flags, addr)
}

// ================================================
Expand Down

0 comments on commit b3badc7

Please sign in to comment.