Skip to content

Commit

Permalink
fix: parameter to _onPeerDisconnected
Browse files Browse the repository at this point in the history
`_onPeerDisconnected` is expecting a `PeerInfo` but it was being passed a pubsub `Peer`.

I'm not sure if this is the correct fix but it resolves this error for me:

```
(node:77189) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toB58String' of undefined
    at GossipSub._onPeerDisconnected (/Users/alan/Code/pl/ipfs/js-ipfs/node_modules/libp2p-pubsub/src/index.js:190:34)
    at GossipSub._processMessages (/Users/alan/Code/pl/ipfs/js-ipfs/node_modules/libp2p-gossipsub/src/pubsub.js:120:12)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
```
  • Loading branch information
alanshaw committed Jan 16, 2020
1 parent 8cc71a2 commit d43ceb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class BasicPubSub extends Pubsub {
* @override
* @param {string} idB58Str peer id string in base58
* @param {Connection} conn connection
* @param {PeerInfo} peer peer info
* @param {Peer} peer PubSub peer
* @returns {void}
*
*/
Expand All @@ -117,7 +117,7 @@ class BasicPubSub extends Pubsub {
}
)
} catch (err) {
this._onPeerDisconnected(peer, err)
this._onPeerDisconnected(peer.info, err)
}
}

Expand Down

0 comments on commit d43ceb5

Please sign in to comment.