forked from coolaj86/goldilocks.js
Added error handling work-around to prevent the process from crashing.
This commit is contained in:
parent
e462978154
commit
089d85df67
|
@ -154,6 +154,13 @@ module.exports.create = function (deps, config) {
|
|||
}
|
||||
conn.once('error', onError);
|
||||
conn.once('data', function (chunk) {
|
||||
//Adding this to track problems with error handling TODO: Remove this error handler.
|
||||
conn.on('error', function(err) {
|
||||
console.log("Received error in tcpHandler after removing error listener.",
|
||||
"Number of errorListeners:",
|
||||
conn.listenerCount()
|
||||
);
|
||||
});
|
||||
conn.removeListener('error', onError);
|
||||
peek(conn, chunk, opts);
|
||||
});
|
||||
|
|
|
@ -56,7 +56,11 @@ module.exports.create = function (deps, config, tcpMods) {
|
|||
|
||||
socket.on('error', function (err) {
|
||||
console.log('wrapped TLS socket error', err);
|
||||
reader.emit('error', err);
|
||||
if(reader.listenerCount("error")){
|
||||
reader.emit('error', err);
|
||||
} else {
|
||||
console.log('Wrapped TLS socket had no error handlers for error. Socket object: ', reader);
|
||||
}
|
||||
});
|
||||
writer.on('error', function (err) {
|
||||
console.error('socket-pair writer error', err);
|
||||
|
|
Loading…
Reference in New Issue