Browse files

Ignore weird error message on quit for some servers

  • Loading branch information...
1 parent 8c93be6 commit 1799f3bed78f2eaf340f906f934c8abb0acd0b42 Alexandru Vladutu committed Mar 19, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/irc.js
@@ -431,6 +431,9 @@ function Client(server, nick, opt) {
util.log("\033[01;31mERROR: " + util.inspect(message) + "\033[0m");
else {
+ // ignore quit error message (happens with some servers, ex: freenode)
+ if (self._lastCommand === 'QUIT' && command === 'ERROR'
+ && message.args[0] && message.args[0].match(/Closing link/i)) { break; }
self.emit('unhandled', message);
if ( self.opt.debug )
util.log("\033[01;31mUnhandled message: " + util.inspect(message) + "\033[0m");
@@ -596,8 +599,8 @@ Client.prototype.send = function(command) { // {{{
args[args.length-1] = ":" + args[args.length-1];
- // Remove the command
- args.shift();
+ // Remove the command from args and remember it
+ this._lastCommand = args.shift();
if ( this.opt.debug )
util.log('SEND: ' + command + " " + args.join(" "));

4 comments on commit 1799f3b

There should be a better way to handle this case, the match and the command state checking just feel icky

Dear god freenode is a blight to the rest of the irc world


alessioalex replied Mar 19, 2012

I've only seen this on freenode so far, so it's icky indeed, but I'm not sure what the best way to deal with this would be. The QUIT command is sent, so the server just shouldn't send that weird error message back anyway.

I reported the issue to freenode, and the response goes as such

it's because the eventloop handles stuff lazily
we flush the linebufs on disconnect
sometimes you get it, sometimes you don't
it depends on how well the eventloop has done it's job

They use a ratbox derivative, but I'm not aware of any other ratbox based network exhibiting this type behavior. But the situation convinces me more that this is something that the server should just handle properly in the first place.


alessioalex replied Mar 19, 2012

Absolutely, I just thought this should be present so others won't feel node-irc is buggy or to loose time investigating this issue. Devs are mostly aware of freenode, so that may be the first choice when they decide to play around with the library (as I did).

Please sign in to comment.