Trace pruning of sockets from a set.

This commit is contained in:
whitequark 2017-01-25 02:23:10 +00:00
parent 497aa5919a
commit 5cb4e6f760
1 changed files with 2 additions and 1 deletions

View File

@ -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
}
}