Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Allow TorControl.destroy to be idempotent.
Browse files Browse the repository at this point in the history
This should address the failure reported in:
#14675 (comment)

fix #14630

Auditors: @diracdeltas

Test Plan: see #14630
  • Loading branch information
riastradh-brave committed Jul 10, 2018
1 parent 0899642 commit 2a30a9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/tor.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,10 +955,14 @@ class TorControl extends EventEmitter {
* - Mark the control closed so it can't be used any more.
* - Pass an error to all callbacks waiting for command completion.
*
* Idempotent. Repeated calls have no effect.
*
* @param {Error} err
*/
destroy (err) {
assert(!this._destroyed)
if (this._destroyed) {
return
}
this._readable.destroy(err)
this._writable.end()
this._writable.destroy(err)
Expand Down

0 comments on commit 2a30a9b

Please sign in to comment.