mirror of
https://github.com/OMGeeky/gdriver2.git
synced 2026-02-15 22:14:31 +01:00
misc
This commit is contained in:
@@ -6,7 +6,7 @@ pub async fn start() -> Result<()> {
|
||||
|
||||
let name = "test1".to_string();
|
||||
let config = &CONFIGURATION;
|
||||
let client: WorldClient = create_client(config.ip, config.port).await?;
|
||||
let client: WorldClient = create_client(&config.socket_path).await?;
|
||||
|
||||
let hello = client
|
||||
.hello(tarpc::context::current(), name.to_string())
|
||||
@@ -18,14 +18,10 @@ pub async fn start() -> Result<()> {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub async fn create_client(ip: IpAddr, port: u16) -> Result<WorldClient> {
|
||||
let server_addr = (ip, port);
|
||||
let transport = tarpc::serde_transport::tcp::connect(&server_addr, Json::default)
|
||||
pub async fn create_client(socket_path: impl AsRef<Path>) -> Result<WorldClient> {
|
||||
let transport = tarpc::serde_transport::unix::connect(socket_path, Json::default)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
println!("Could not connect");
|
||||
e
|
||||
})?;
|
||||
.inspect_err(|_| println!("Could not connect"))?;
|
||||
let var_name = WorldClient::new(client::Config::default(), transport);
|
||||
let client = var_name.spawn();
|
||||
Ok(client)
|
||||
|
||||
Reference in New Issue
Block a user