remove derive data.
@@ -45,9 +45,6 @@ pub struct Stronghold {
clients: HashMap<ClientId, ActorRef<ClientMsg>>,
target: ActorRef<ClientMsg>,
- // data derived from the client_paths.
- derive_data: HashMap<Vec<u8>, Vec<u8>>,
-
#[cfg(feature = "communication")]
// communication actor ref
communication_actor: Option<ActorRef<CommunicationRequest<SHRequest, ClientMsg>>>,
@@ -61,10 +58,6 @@ impl Stronghold {
let id_str: String = client_id.into();
let mut clients = HashMap::new();
- let mut derive_data = HashMap::new();
-
- derive_data.insert(client_path.clone(), client_path);
-
let client = system
.actor_of_args::<Client, _>(&id_str, client_id)
.expect(line_error!());
@@ -79,7 +72,7 @@ impl Stronghold {
Self {
system,
clients,
- derive_data,
+
target: client,
#[cfg(feature = "communication")]
@@ -110,7 +103,7 @@ impl Stronghold {
.expect(line_error!());
self.clients.insert(client_id, client.clone());
- self.derive_data.insert(client_path.clone(), client_path);
+
self.target = client;
}
@@ -388,12 +381,9 @@ impl Stronghold {
filename: Option<String>,
path: Option<PathBuf>,
) -> StatusMessage {
- let data = self.derive_data.get(&client_path).expect(line_error!());
- let client_id = ClientId::load_from_path(&data.as_ref(), &client_path).expect(line_error!());
+ let client_id = ClientId::load_from_path(&client_path, &client_path).expect(line_error!());
let former_cid = if let Some(cp) = former_client_path {
- self.derive_data.insert(cp.clone(), cp.clone());
-
Some(ClientId::load_from_path(&cp, &cp).expect(line_error!()))
} else {
None
@@ -473,16 +463,13 @@ impl Stronghold {
/// `kill_actor` is `true` both the internal actor and the client actor will be killed. Otherwise, the cache of the
/// current target actor will be cleared.
pub async fn kill_stronghold(&mut self, client_path: Vec<u8>, kill_actor: bool) -> StatusMessage {
- let data = self.derive_data.get(&client_path).expect(line_error!());
- let client_id = ClientId::load_from_path(&data.as_ref(), &client_path).expect(line_error!());
+ let client_id = ClientId::load_from_path(&client_path.clone(), &client_path).expect(line_error!());
let client_str: String = client_id.into();
if kill_actor {
self.clients.remove(&client_id);
- self.derive_data.remove(&client_path);
-
self.system.stop(&self.target);
let internal = self
.system
