diff --git a/lib/tcp/index.js b/lib/tcp/index.js index 4aae343..5198fc2 100644 --- a/lib/tcp/index.js +++ b/lib/tcp/index.js @@ -160,7 +160,9 @@ module.exports.create = function (deps, config) { "Number of errorListeners:", conn.listenerCount("error"), "Error: ", err ); - if(!conn.listenerCount("error")) conn.emit("error", err); + if(conn.listenerCount("error") <= 1) { + process.nextTick(function() {conn.emit("error", err);}); + } }); conn.removeListener('error', onError); peek(conn, chunk, opts);