You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
fnstart_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 serverlet 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
The text was updated successfully, but these errors were encountered:
Hello @weiyuhang2011, I just patched a fix for this issue. You can use the karyon_jsonrpc from the master branch until I deploy the new changes and fixes to crates.io.
Hey @weiyuhang2011, yes, the address is correct. You can also just use the path: Server::builder("unix:/tmp/karyon-test.sock"). However, the issue was due to a bug in handling new connections from the server side. It was trying to resolve the client address for debugging.
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:
I use
nc -U /tmp/karyon-test.sock
to test the server. Below is the server log:The text was updated successfully, but these errors were encountered: