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.
|
/// Pending replies to send. |
|
pending_replies: VecDeque<Reply>, |
Are you planning to do it yourself in a pull request?
No
Description
I/O should not happen in the
NetworkBehaviourimplementation. It should happen in theConnectionHandlerimplementation.Motivation
All
NetworkBehaviourimplementations 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-identifydrives the future returning a response to a remote in theNetworkBehaviour::pollimplementation.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