Skip to content

Commit 8c06aeb

Browse files
committed
Revert "Add variable size ping"
This reverts commit eeacd42.
1 parent 8671c59 commit 8c06aeb

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

talpid-wireguard/src/connectivity_check.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,13 @@ mod test {
511511

512512
#[derive(Default)]
513513
struct MockPinger {
514-
on_send_ping: Option<Box<dyn FnMut(u16) + Send>>,
514+
on_send_ping: Option<Box<dyn FnMut() + Send>>,
515515
}
516516

517517
impl Pinger for MockPinger {
518-
fn send_icmp_sized(&mut self, size: u16) -> Result<(), crate::ping_monitor::Error> {
518+
fn send_icmp(&mut self) -> Result<(), crate::ping_monitor::Error> {
519519
if let Some(callback) = self.on_send_ping.as_mut() {
520-
(callback)(size);
520+
(callback)();
521521
}
522522
Ok(())
523523
}

talpid-wireguard/src/ping_monitor/icmp.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ impl Pinger {
132132
}
133133

134134
impl super::Pinger for Pinger {
135-
fn send_icmp_sized(&mut self, size: u16) -> Result<()> {
136-
const IPV4_HEADER_SIZE: u16 = 20;
137-
let mut message = vec![0u8; (size - IPV4_HEADER_SIZE) as usize];
135+
fn send_icmp(&mut self) -> Result<()> {
136+
let mut message = [0u8; 50];
138137
self.construct_icmpv4_packet(&mut message)?;
139138
self.send_ping_request(&message, self.addr)
140139
}

talpid-wireguard/src/ping_monitor/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ pub use imp::Error;
1111
/// Trait for sending ICMP requests to get some traffic from a remote server
1212
pub trait Pinger: Send {
1313
/// Sends an ICMP packet
14-
fn send_icmp(&mut self) -> Result<(), Error> {
15-
self.send_icmp_sized(50)
16-
}
17-
/// Sends an ICMP packet of the given size
18-
fn send_icmp_sized(&mut self, size: u16) -> Result<(), Error>;
14+
fn send_icmp(&mut self) -> Result<(), Error>;
1915
/// Clears all resources used by the pinger.
2016
fn reset(&mut self) {}
2117
}

0 commit comments

Comments
 (0)