fn remove_hungup_and_drained_tubes<T, U>(
events: &SmallVec<[TriggeredEvent<T>; 16]>,
tubes: &mut Vec<U>,
get_tube_index: fn(token: &T) -> Option<usize>,
make_token_for_tube: fn(_: usize) -> T
) -> Result<()>where
When control tubes hang up, we want to make sure that we’ve fully drained the underlying socket before removing it. This function also handles removing closed sockets in such a way that avoids phantom events.
tube_indices_to_remove is the set of indices that we already know should
be removed (e.g. from getting a disconnect error on read).