Skip to content

Commit b3badc7

Browse files
authored
fix: correct recv_from_with_flags and sendto (#81)
The behavior is wrong with original function. Fix with simple lines.
1 parent 2e337a0 commit b3badc7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/socket.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,12 @@ impl Socket {
285285
/// `recvfrom` call.
286286
///
287287
/// [`recv_from`]: #method.recv_from
288-
pub fn recv_from_with_flags(&self, buf: &mut [u8], flags: i32) -> io::Result<usize> {
289-
self.inner.recv(buf, flags)
288+
pub fn recv_from_with_flags(
289+
&self,
290+
buf: &mut [u8],
291+
flags: i32,
292+
) -> io::Result<(usize, SockAddr)> {
293+
self.inner.recv_from(buf, flags)
290294
}
291295

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

350354
// ================================================

0 commit comments

Comments
 (0)