Skip to content

Commit b9d063f

Browse files
fixup: use patched UdpSender
1 parent cb510c3 commit b9d063f

File tree

3 files changed

+18
-31
lines changed

3 files changed

+18
-31
lines changed

Cargo.lock

Lines changed: 14 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ iroh-quinn = { git = "https://github.com/n0-computer/quinn", branch = "main-iroh
4747
iroh-quinn-proto = { git = "https://github.com/n0-computer/quinn", branch = "main-iroh" }
4848
iroh-quinn-udp = { git = "https://github.com/n0-computer/quinn", branch = "main-iroh" }
4949

50+
netwatch = { git = "https://github.com/n0-computer/net-tools", branch = "main" }
51+
5052
# iroh-quinn = { path = "../iroh-quinn/quinn" }
5153
# iroh-quinn-proto = { path = "../iroh-quinn/quinn-proto" }
5254
# iroh-quinn-udp = { path = "../iroh-quinn/quinn-udp" }

iroh/src/magicsock/transports/ip.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,10 @@ impl IpTransport {
101101
}
102102

103103
pub(super) fn create_sender(&self) -> IpSender {
104-
let socket = self.socket.clone();
105-
let sender = socket.clone().create_sender();
104+
let sender = self.socket.clone().create_sender();
106105
IpSender {
107106
bind_addr: self.bind_addr,
108107
sender,
109-
socket,
110108
metrics: self.metrics.clone(),
111109
}
112110
}
@@ -134,27 +132,15 @@ impl IpNetworkChangeSender {
134132
}
135133
}
136134

137-
#[derive(Debug)]
135+
#[derive(Debug, Clone)]
138136
#[pin_project]
139137
pub(super) struct IpSender {
140138
bind_addr: SocketAddr,
141-
socket: Arc<UdpSocket>,
142139
#[pin]
143140
sender: UdpSender,
144141
metrics: Arc<MagicsockMetrics>,
145142
}
146143

147-
impl Clone for IpSender {
148-
fn clone(&self) -> Self {
149-
Self {
150-
bind_addr: self.bind_addr,
151-
socket: self.socket.clone(),
152-
sender: self.socket.clone().create_sender(),
153-
metrics: self.metrics.clone(),
154-
}
155-
}
156-
}
157-
158144
impl IpSender {
159145
pub(super) fn is_valid_send_addr(&self, dst: &SocketAddr) -> bool {
160146
// Our net-tools crate binds sockets to their specific family. This means an IPv6

0 commit comments

Comments
 (0)