Replies: 1 comment
-
|
You probably need to establish a new RPC connection from each thread. So you would just tell the thread the address of the RPC server, and the port number to be opened, and that thread would start its own connection and call If you really need to share a single connection, then you need to devise some sort of cross-thread signaling to use here, so that your side threads can proxy requests through your main thread and out over the connection. One way to accomplish this would be to create loopback RPC connections. The main thread could operate as a server which the other threads connect to. It can then pass along capnp capabilities to/from the upstream connection. This is rather inefficient, of course, requiring every message go through a loopback connection. Eventually I want to write an in-process cross-thread RPC transport, but I haven't gotten around to it yet. You could potentially build this yourself (e.g. a custom implementation of VatNetwork or MessageStream that doesn't actually serialize messages but just moves them around in memory), but that would be fairly involved. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have this schema (simplified):
I am implementing a library for our app.
The 3 methods:
getNetworkInterfaces(),getPortNums(),openPort()are called from the main thread.The
send()'s that are called overPort&OneWaySession(for 2-way connection) should have a new TCP connection, and are called/served by a thread per connection (this is the way the App is built, out of my control).My question:
Since an
EventLoopis tied to a thread, I was thinking of creating a newEzRpcClientinstance for each port.Call
ez_rpc_client.getMain<NetworkMessaging>(), and callopenPort()on it.I now have a TX point (a
Port.send()) and RX point (aOneWaySession.send()).They will be served on that thread.
The problem is, of course, that
openPort()is called by the main thread, so this is not a valid solution.Any idea how I can solve this?
Beta Was this translation helpful? Give feedback.
All reactions