Don't build a new connection if it already exists

There was also a lot of unneeded overhead in Connection::new() to get
the path to compare against, so split that out into a settings struct
This commit is contained in:
2020-05-16 18:44:02 +01:00
parent e08ec6b476
commit 169249b716
8 changed files with 166 additions and 92 deletions

View File

@@ -24,7 +24,7 @@ impl telepathy::ConnectionInterfaceRequests for Connection {
&self,
request: HashMap<&str, VarArg>,
) -> Result<(dbus::Path<'static>, HashMap<String, VarArg>), MethodErr> {
println!("Connection<{}>::create_channel({:?})", self.id, request);
println!("Connection<{}>::create_channel({:?})", self.id(), request);
Err(MethodErr::no_arg()) // FIXME: should be NotImplemented?
}
@@ -33,17 +33,17 @@ impl telepathy::ConnectionInterfaceRequests for Connection {
&self,
request: HashMap<&str, VarArg>,
) -> Result<(bool, dbus::Path<'static>, HashMap<String, VarArg>), MethodErr> {
println!("Connection<{}>::ensure_channel({:?})", self.id, request);
println!("Connection<{}>::ensure_channel({:?})", self.id(), request);
Err(MethodErr::no_arg()) // FIXME: should be NotImplemented?
}
fn channels(&self) -> Result<Vec<ChannelSpec>, MethodErr> {
println!("Connection<{}>::channels()", self.id);
println!("Connection<{}>::channels()", self.id());
Ok(vec![])
}
fn requestable_channel_classes(&self) -> Result<Vec<RequestableChannelSpec>, MethodErr> {
println!("Connection<{}>::requestable_channel_classes()", self.id);
println!("Connection<{}>::requestable_channel_classes()", self.id());
Ok(crate::padfoot::requestables())
}
}