refactor: simplify client handling by removing Arc and Mutex wrappers from MasterConnectorTrait
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::{fs::File, io::Read, sync::Arc};
|
||||
use std::{fs::File, io::Read};
|
||||
|
||||
use tokio::{fs::read, sync::Mutex};
|
||||
use tokio::fs::read;
|
||||
|
||||
use nxmesh_proto::agent_service_client::AgentServiceClient;
|
||||
use tonic::transport::{Certificate, ClientTlsConfig, Identity};
|
||||
@@ -11,7 +11,7 @@ use crate::config::settings::{MAuthSettings, TLSSettings};
|
||||
use super::{AgentClient, MasterConnectorTrait};
|
||||
|
||||
pub struct SshMasterConnector {
|
||||
client: Arc<Mutex<AgentClient>>,
|
||||
client: AgentClient,
|
||||
}
|
||||
|
||||
impl SshMasterConnector {
|
||||
@@ -34,7 +34,7 @@ impl SshMasterConnector {
|
||||
.connect_lazy();
|
||||
|
||||
// Create the gRPC client
|
||||
let client = Arc::new(Mutex::new(AgentServiceClient::new(endpoint)));
|
||||
let client = AgentServiceClient::new(endpoint);
|
||||
Ok(Self { client })
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ impl MasterConnectorTrait for SshMasterConnector {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_client(&self) -> Arc<Mutex<AgentClient>> {
|
||||
fn get_client(&self) -> AgentClient {
|
||||
self.client.clone()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user