Skip to content

Dont emit peer:disconnect when a connection is still open #301

Closed
@jacobheun

Description

@jacobheun

Currently the peer:disconnect event will be fired anytime a muxed connection to a peer is closed, https://github.com/libp2p/js-libp2p/blob/v0.24.3/src/index.js#L85. However, since it's possible to have an outbound and inbound connection to a peer, closing one of those still means we are connected to a that peer. Only when we no longer have a connection to a peer, should we emit the disconnect event.

Performing a check of the total connections for a given peer before emitting the disconnect event when we receive a muxed connection closed event, would enable us to only emit the event when all connections are closed.

Reference #299 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: Good to have, but can wait until someone steps upexp/noviceSomeone with a little familiarity can pick uphelp wantedSeeking public contribution on this issuekind/bugA bug in existing code (including security flaws)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions