Skip to content

Commit

Permalink
Destroy existing socket before allocating a new one
Browse files Browse the repository at this point in the history
Signed-off-by: Brandon Valentine <brandon@brandonvalentine.com>
  • Loading branch information
bval committed Oct 1, 2018
1 parent c9abb42 commit 78f0b5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/irc.js
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,10 @@ Client.prototype.connect = function(retryCount, callback) {
};
}

// destroy old socket before allocating a new one
if (self.conn !== null)
self.conn.destroy();

// try to connect to the server
if (self.opt.secure) {
connectionOpts.rejectUnauthorized = !self.opt.selfSigned;
Expand Down

0 comments on commit 78f0b5d

Please sign in to comment.