Skip to content

Commit 8e6fc7f

Browse files
bors[bot]korken89
andauthored
Merge #568
568: Expose `self.sockets` in `Interface` r=Dirbaio a=korken89 This is needed to not loose access to methods on sockets, e.g. iterating over them and closing or checking which ports are being used. Not sure if there is some other way this is meant to be done. Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2 parents 29d0fcc + 1a28ef5 commit 8e6fc7f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/iface/interface.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,16 @@ where
555555
&mut self.device
556556
}
557557

558+
/// Get an iterator to the inner sockets.
559+
pub fn sockets(&self) -> impl Iterator<Item = &Socket<'a>> {
560+
self.sockets.iter()
561+
}
562+
563+
/// Get a mutable iterator to the inner sockets.
564+
pub fn sockets_mut(&mut self) -> impl Iterator<Item = &mut Socket<'a>> {
565+
self.sockets.iter_mut()
566+
}
567+
558568
/// Add an address to a list of subscribed multicast IP addresses.
559569
///
560570
/// Returns `Ok(announce_sent)` if the address was added successfully, where `annouce_sent`

0 commit comments

Comments
 (0)