mscdex/node-imap — pull request #53 by vedmalex (2012-03-29 12:45:59+00:00)
Title: fixed: unlimited error loop

so this code make error recurrung call and as the result stack overflow when come things wrong with connection lost connection or dns lookup failed

var cleartext = pair.cleartext;
cleartext.socket = socket;

function onerror(e) {
if (cleartext._controlReleased)
cleartext.socket.emit('error', e);// in this line we call emit error event in recurring way.
}

socket.on('error', onerror);// this code the same as cleartext.socket.on('error', onerror)