Skip to content

protocols/identify: Move I/O to ConnectionHandler #2885

Closed
@mxinden

Description

@mxinden

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions