Skip to content

Commit

Permalink
Add bind_addr for udp stream
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesc committed Apr 22, 2024
1 parent 026fa65 commit 8218469
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/proto/src/udp/udp_client_stream.rs
Expand Up @@ -244,7 +244,8 @@ impl<S: DnsUdpSocket + Send + 'static, MF: MessageFinalizer> DnsRequestSender
self.timeout,
Box::pin(async move {
let socket: S =
NextRandomUdpSocket::new_with_closure(&addr, &bind_addr, creator).await?;
NextRandomUdpSocket::new_with_bind_addr_and_closure(&addr, &bind_addr, creator)
.await?;
send_serial_message_inner(message, message_id, verifier, socket, recv_buf_size)
.await
}),
Expand Down
7 changes: 6 additions & 1 deletion crates/proto/src/udp/udp_stream.rs
Expand Up @@ -264,7 +264,12 @@ impl<S: UdpSocket + 'static> NextRandomUdpSocket<S> {

impl<S: DnsUdpSocket> NextRandomUdpSocket<S> {
/// Create a future with generator
pub(crate) fn new_with_closure(
pub(crate) fn new_with_closure(name_server: &SocketAddr, func: UdpCreator<S>) -> Self {
NextRandomUdpSocket::<S>::new_with_bind_addr_and_closure(name_server, &None, func)
}

/// Create a future with generator
pub(crate) fn new_with_bind_addr_and_closure(
name_server: &SocketAddr,
bind_addr: &Option<SocketAddr>,
func: UdpCreator<S>,
Expand Down

0 comments on commit 8218469

Please sign in to comment.