Closed
Description
Description
I/O should not happen in the NetworkBehaviour
implementation. It should happen in the ConnectionHandler
implementation.
Motivation
All NetworkBehaviour
implementations are driven by a single future task. Opposite to that we spawn a new future task for every connection. Doing as much as possible, especially I/O, on the connection tasks and not on the main task allows logic to potentially run in parallel.
Current Implementation
Today libp2p-identify
drives the future returning a response to a remote in the NetworkBehaviour::poll
implementation.
rust-libp2p/protocols/identify/src/identify.rs
Lines 53 to 54 in 66c2755
Are you planning to do it yourself in a pull request?
No