mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-11-10 17:47:07 +08:00
Suppress ETIMEDOUT errors
This commit is contained in:
parent
0fc0caa0f1
commit
dc662520b2
1 changed files with 7 additions and 2 deletions
|
@ -190,8 +190,10 @@ class IMAPServer extends EventEmitter {
|
|||
|
||||
let remoteAddress = socket.remoteAddress;
|
||||
|
||||
let errorTimer = false;
|
||||
let returned = false;
|
||||
let onError = err => {
|
||||
clearTimeout(errorTimer);
|
||||
if (returned) {
|
||||
return;
|
||||
}
|
||||
|
@ -223,7 +225,10 @@ class IMAPServer extends EventEmitter {
|
|||
// upgrade connection
|
||||
let tlsSocket = new tls.TLSSocket(socket, socketOptions);
|
||||
|
||||
tlsSocket.once('close', onError);
|
||||
let onCloseError = () => {
|
||||
errorTimer = setTimeout(onError, 150);
|
||||
};
|
||||
tlsSocket.once('close', onCloseError);
|
||||
tlsSocket.once('error', onError);
|
||||
tlsSocket.once('_tlsError', onError);
|
||||
tlsSocket.once('clientError', onError);
|
||||
|
@ -231,7 +236,7 @@ class IMAPServer extends EventEmitter {
|
|||
|
||||
tlsSocket.on('secure', () => {
|
||||
socket.removeListener('error', onError);
|
||||
tlsSocket.removeListener('close', onError);
|
||||
tlsSocket.removeListener('close', onCloseError);
|
||||
tlsSocket.removeListener('error', onError);
|
||||
tlsSocket.removeListener('_tlsError', onError);
|
||||
tlsSocket.removeListener('clientError', onError);
|
||||
|
|
Loading…
Reference in a new issue