Skip to content

Commit

Permalink
fix: listener binds
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Aug 30, 2023
1 parent 925b4d4 commit 9896fc0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/core/src/lib/base_protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export class BaseProtocol extends StreamManager implements IBaseProtocol {
) {
super(
multicodec,
components.connectionManager.getConnections.bind(components),
components.connectionManager.getConnections.bind(
components.connectionManager
),
log
);

Expand All @@ -35,12 +37,12 @@ export class BaseProtocol extends StreamManager implements IBaseProtocol {

this.addLibp2pEventListener(
"peer:update",
super.handlePeerUpdateStreamPool
this.handlePeerUpdateStreamPool.bind(this)
);
// TODO: might be better to check with `connection:close` event
this.addLibp2pEventListener(
"peer:disconnect",
super.handlePeerDisconnectStreamPool
this.handlePeerDisconnectStreamPool.bind(this)
);
}

Expand Down

0 comments on commit 9896fc0

Please sign in to comment.