diff --git a/crates/tor-ptmgr/src/ipc.rs b/crates/tor-ptmgr/src/ipc.rs index 597e8af9d..6fdde9b54 100644 --- a/crates/tor-ptmgr/src/ipc.rs +++ b/crates/tor-ptmgr/src/ipc.rs @@ -601,7 +601,6 @@ impl PluggableTransport { /// /// If it hasn't been launched, the returned map will be empty. // TODO(eta): Actually figure out a way to expose this more stably. - #[allow(dead_code)] // TODO: remove unless this turns out to be useful. pub(crate) fn transport_methods(&self) -> &HashMap { &self.cmethods } diff --git a/crates/tor-ptmgr/src/lib.rs b/crates/tor-ptmgr/src/lib.rs index 372c9ad26..6054e9714 100644 --- a/crates/tor-ptmgr/src/lib.rs +++ b/crates/tor-ptmgr/src/lib.rs @@ -51,7 +51,7 @@ use futures::channel::oneshot; use futures::stream::FuturesUnordered; use futures::task::SpawnExt; use futures::{select, FutureExt, StreamExt}; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::future::Future; use std::path::{Path, PathBuf}; use std::pin::Pin; @@ -169,9 +169,17 @@ impl PtReactor { let _ = sender.send(Ok(method.clone())); } } + + let requested: HashSet<_> = covers.iter().collect(); + let found: HashSet<_> = pt.transport_methods().iter().map(|(t, _)| t).collect(); + if requested != found { + warn!("Bug: PT {} succeeded, but did not give the same transports we asked for. ({:?} vs {:?})", + pt.identifier(), found, requested); + } } } } + /// Called to remove a pluggable transport from the shared state. fn remove_pt(&self, pt: PluggableTransport) { let mut state = self.state.write().expect("ptmgr state poisoned");