Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: close peer streams in removePeer
  • Loading branch information
wemeetagain committed Jul 16, 2020
commit 9d9c3c8006467436a38eada4067a54d1c4118ba0
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ class PubsubBaseProtocol extends EventEmitter {
const peerStreams = this.peers.get(id)
if (!peerStreams) return

// close peer streams
peerStreams.removeAllListeners()
peerStreams.close()

// delete peer streams
this.log('delete peer', id)
this.peers.delete(id)

Expand Down