From 97d82b491a6027d4c62169626cad053d05db18d0 Mon Sep 17 00:00:00 2001 From: youkunhuang Date: Wed, 20 Jun 2018 14:40:31 +0800 Subject: [PATCH] chore(websocket): add error ignore list --- bin/proxy/websocket.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/proxy/websocket.js b/bin/proxy/websocket.js index 80d8cdd6..acaaae1c 100644 --- a/bin/proxy/websocket.js +++ b/bin/proxy/websocket.js @@ -92,6 +92,11 @@ function bind_listen(server) { } d.on('error', function(err) { + if (err && err.message && errorIgnore[err.message] === 'ignore') { + logger.warn(err && err.stack); + return; + } + if (err && err.stack && err.message) { const key = err.message; const content = `

错误堆栈

${err.stack}

`; @@ -263,3 +268,11 @@ exports.start_listen = function() { bind_listen(wss); } }; + +const errorIgnore = { + 'socket hang up': 'ignore', + 'Cannot read property \'asyncReset\' of null': 'ignore', + 'Cannot read property \'resume\' of null': 'ignore', + 'write ECONNRESET': 'ignore', + 'This socket is closed': 'ignore' +};