senchalabs/connect — pull request #564 by eknkc (2012-05-10 16:11:57+00:00)
Title: Remove socket event listeners on callback

Hi,

static middleware attaches a callback to `req.socket`'s error event, which causes an event listener leak due to reused sockets by keep-alive connections. Then the eventemitter starts logging;

warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

I was not sure if it would be better to just remove the event attachment but this removes the error event listener from `req.socket` when the request closes somehow.

This is related to Issue #527.