Skip to content

Receiving error when server tries to request client. #32

@mahdi-shojaee

Description

@mahdi-shojaee

Thanks for this nice crate,

Sending a request to the client in the callback of the acceptor method fails.

Expected Behavior

Expected to request_response method return the response for the request.

Actual Behavior

request_response method returns error:

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: APPLICATION_ERROR: TODO: should be error details'

Steps to Reproduce

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
    RSocketFactory::receive()
        .transport(TcpServerTransport::from("127.0.0.1:7878"))
        .acceptor(Box::new(|setup, socket| {
            println!("socket establish: setup={:?}", setup);
            tokio::spawn(async move {
                let req = Payload::builder().set_data_utf8("Hello World!").build();
                let res = socket.request_response(req).await.unwrap();
                println!("SERVER request CLIENT success: response={:?}", res);
            });
            // Return a responder.
            // You can write you own responder by implementing `RSocket` trait.
            Ok(Box::new(EchoRSocket))
        }))
        .on_start(Box::new(|| println!("echo server start success!")))
        .serve()
        .await
}

Your Environment

Darwin Mahdis-MacBook-Pro.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

Cargo.toml dependencies

[dependencies]
tokio = { version = "0.3.6", features = ["full"] }
rsocket_rust = "0.6.0"
rsocket_rust_transport_tcp = "0.6.0"

I also tried the "0.5.1" with the appropriate tokio version and also the git master branch.

Any suggestion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions