Skip to content

Commit

Permalink
Trace pruning of sockets from a set.
Browse files Browse the repository at this point in the history
whitequark committed Jan 25, 2017
1 parent b90495f commit 2c321a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/socket/set.rs
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ impl<'a, 'b: 'a, 'c: 'a + 'b> Set<'a, 'b, 'c> {
/// Pruning affects sockets with reference count 0. Open sockets are closed.
/// Closed sockets are removed and dropped.
pub fn prune(&mut self) {
for item in self.sockets.iter_mut() {
for (index, item) in self.sockets.iter_mut().enumerate() {
let mut may_remove = false;
if let &mut Some(Item { refs: 0, ref socket }) = item {
match socket {
@@ -147,6 +147,7 @@ impl<'a, 'b: 'a, 'c: 'a + 'b> Set<'a, 'b, 'c> {
}
}
if may_remove {
net_trace!("[{}]: pruning", index);
*item = None
}
}

0 comments on commit 2c321a9

Please sign in to comment.