From 4b9db320c0ed606e376361da4ca66c871f504aad Mon Sep 17 00:00:00 2001 From: John Shaver Date: Fri, 4 May 2018 09:34:27 -0700 Subject: [PATCH] changed errors a bit more. --- lib/tcp/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);