felixge/node-ar-drone — pull request #79 by bkw (2013-10-21 14:57:57+00:00)
Title: fix timeout errors on socket end

Requesting comments on this one: removing _all_ listeners on the tcp video socket seems to break disconnection on recent node versions, since we also remove the internal listeners (namely the `finish` event). The effect is that closing a socket basically does nothing, until we catch a timeout error later on.

Lacking a drone, I couldn't verify that moving the removeAllListeners() call to the `close` handler is enough to have the desired effect for reusing the socket on reconnection. At least it doesn't break test anymore for me.
An alternative proposal (though less elegant) would be to only remove the listeners we add ourselves.

CC @eschnou, since you introduced the removeAllListeners() call, I'd love Your feedback on this issue.