Skip to content

Commit

Permalink
fix: fix: fix: error loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Dec 3, 2022
1 parent 79dbf69 commit 14fe83f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion lib/peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 363,6 @@ class Peer extends EventEmitter {
this.connected = false

debug('destroy %s %s (error: %s)', this.type, this.id, err && (err.message || err))
this.emit('destroy', err)

clearTimeout(this.connectTimeout)
clearTimeout(this.handshakeTimeout)
Expand Down
5 changes: 1 addition & 4 deletions lib/torrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,10 946,6 @@ class Torrent extends EventEmitter {
this.client.emit('upload', uploaded)
})

newPeer.on('destroy', () => {
this.removePeer(newPeer)
})

this._peers[newPeer.id] = newPeer
this._peersLength = 1
}
Expand Down Expand Up @@ -1333,6 1329,7 @@ class Torrent extends EventEmitter {
* Attempts to update a peer's requests
*/
_updateWire (wire) {
if (wire.destroyed) return false
// to allow function hoisting
const self = this

Expand Down

0 comments on commit 14fe83f

Please sign in to comment.