-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
I tried to build a jsonrpc server using unix socket. But it seems like the server throw panic on handling connection.
This is my server code:
fn start_run() {
use karyon_core::async_util::sleep;
use karyon_jsonrpc::Server;
use rpc::Calc;
use std::sync::Arc;
use std::time::Duration;
smol::block_on(async {
let calc = Arc::new(Calc {});
// Creates a new server
let server = Server::builder("unix:///tmp/karyon-test.sock")
.expect("Create a new server builder")
.service(calc.clone())
.pubsub_service(calc)
.build()
.await
.expect("Build a new server");
// Start the server
server.start();
sleep(Duration::MAX).await;
});
}I use nc -U /tmp/karyon-test.sock to test the server. Below is the server log:
2024-07-04T09:17:01Z INFO karyon_jsonrpc::server] RPC server listens to the endpoint: unix://tmp/karyon-test.sock
thread 'smol-executor' panicked at 'get peer endpoint: IO(Kind(AddrNotAvailable))', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/karyon_jsonrpc-0.1.5/src/server/mod.rs:110:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace