Skip to content

Instantly share code, notes, and snippets.

@prawnsalad
Created August 9, 2015 16:12
Show Gist options
  • Save prawnsalad/bbc34e9fc69a6c6de7e8 to your computer and use it in GitHub Desktop.
Save prawnsalad/bbc34e9fc69a6c6de7e8 to your computer and use it in GitHub Desktop.
IrcConnection.prototype.end = function (data) {
var that = this;
if (!this.socket) {
return;
}
this.requested_disconnect = true;
if (data && this.connected) {
// Once the last bit of data has been sent, then re-run this function to close the socket
this.write(data, true, function() {
that.end();
});
return;
}
this.socket.destroy();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment