From f36d7b0c9fe849e8e2893835d188f2f4b242d6ae Mon Sep 17 00:00:00 2001 From: Sajjad Date: Wed, 26 Jun 2024 13:44:34 -0400 Subject: [PATCH] Revert "UdpListener: Use 'poll_send_to' instead of 'poll_send' to allow multiple connections" --- src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index d15382a..acce8a2 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,6 +89,10 @@ impl UdpListener { log::error!("child_tx.send {:?}", err); continue; } + if let Err(e) = socket.connect(&peer_addr).await{ + log::error!("socket.connect {:?}", e); + continue; + } let udp_stream = UdpStream { local_addr, peer_addr, @@ -270,7 +274,7 @@ impl AsyncRead for UdpStream { impl AsyncWrite for UdpStream { fn poll_write(self: Pin<&mut Self>, cx: &mut Context, buf: &[u8]) -> Poll> { - match self.socket.poll_send_to(cx, buf, self.peer_addr) { + match self.socket.poll_send(cx, buf) { Poll::Ready(Ok(r)) => Poll::Ready(Ok(r)), Poll::Ready(Err(e)) => { if let Some(drop) = &self.drop {