Skip to content

Commit

Permalink
Revert "UdpListener: Use 'poll_send_to' instead of 'poll_send' to all…
Browse files Browse the repository at this point in the history
…ow multiple connections"
  • Loading branch information
SajjadPourali authored Jun 26, 2024
1 parent 54099bf commit f36d7b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<io::Result<usize>> {
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 {
Expand Down

0 comments on commit f36d7b0

Please sign in to comment.