File tree 3 files changed +6
-11
lines changed
3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -511,13 +511,13 @@ mod test {
511
511
512
512
#[ derive( Default ) ]
513
513
struct MockPinger {
514
- on_send_ping : Option < Box < dyn FnMut ( u16 ) + Send > > ,
514
+ on_send_ping : Option < Box < dyn FnMut ( ) + Send > > ,
515
515
}
516
516
517
517
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 > {
519
519
if let Some ( callback) = self . on_send_ping . as_mut ( ) {
520
- ( callback) ( size ) ;
520
+ ( callback) ( ) ;
521
521
}
522
522
Ok ( ( ) )
523
523
}
Original file line number Diff line number Diff line change @@ -132,9 +132,8 @@ impl Pinger {
132
132
}
133
133
134
134
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 ] ;
138
137
self . construct_icmpv4_packet ( & mut message) ?;
139
138
self . send_ping_request ( & message, self . addr )
140
139
}
Original file line number Diff line number Diff line change @@ -11,11 +11,7 @@ pub use imp::Error;
11
11
/// Trait for sending ICMP requests to get some traffic from a remote server
12
12
pub trait Pinger : Send {
13
13
/// 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 > ;
19
15
/// Clears all resources used by the pinger.
20
16
fn reset ( & mut self ) { }
21
17
}
You can’t perform that action at this time.
0 commit comments