ptmgr: report an error if PT transports don't match requested.
(I think this may be impossible now, since we check in ipc.rs, but IMO it's best to check.)
This commit is contained in:
parent
fdc49b1fed
commit
dacb3eafda
|
@ -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<PtTransportName, PtClientMethod> {
|
||||
&self.cmethods
|
||||
}
|
||||
|
|
|
@ -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<R: Runtime> PtReactor<R> {
|
|||
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");
|
||||
|
|
Loading…
Reference in New Issue