Socket closed #4979
Socket closed
#4979
-
I've developed a module that lets me create a peer-to-peer network based on rust-libp2p. I'm currently trying to set up a binding between this code and my python code, but I'm getting this error from mdns :
Do you have any idea how to solve it? |
Beta Was this translation helpful? Give feedback.
Answered by
thomaseizinger
Dec 21, 2023
Replies: 1 comment 10 replies
-
Can you post an example to reproduce it? My guess is you are dropping the runtime as you exit the FFI function. |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing the code. I'd suggest to reconsider the design a bit that you've chosen.
For one, you are directly interacting with stdio from within the Rust code. It would be better to employ message passing via a channel. See https://github.com/libp2p/rust-libp2p/blob/master/examples/file-sharing/src/network.rs for some inspiration.
Secondly, it is really important that you continuously, without interruption call
Swarm::next()
and handle each event with minimal latency. TheSwarm
is essentially a giantFuture
and will not make progress if you stop polling it. If you follow the above pattern of an eventloop with message passing, that is solved for you.In regards to your FFI design, …