mx-connect
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -138,21 +138,24 @@ 'use strict'; | ||
let socket = net.connect(options, () => { | ||
clearTimeout(connectTimeout); | ||
if (connected) { | ||
// something already happened, just skip this connection and hope for the best | ||
return socket.end(); | ||
let socket = net.connect( | ||
options, | ||
() => { | ||
clearTimeout(connectTimeout); | ||
if (connected) { | ||
// something already happened, just skip this connection and hope for the best | ||
return socket.end(); | ||
} | ||
connected = true; | ||
// we have a connection! | ||
mx.socket = socket; | ||
mx.localAddress = options.localAddress = socket.localAddress; | ||
mx.localHostname = options.localHostname; | ||
mx.localPort = options.localPort = socket.localPort; | ||
mx.hostname = mx.hostname || socket.remoteAddress; | ||
options.remoteAddress = socket.remoteAddress; | ||
return resolve(mx); | ||
} | ||
connected = true; | ||
// we have a connection! | ||
mx.socket = socket; | ||
mx.localAddress = options.localAddress = socket.localAddress; | ||
mx.localHostname = options.localHostname; | ||
mx.localPort = options.localPort = socket.localPort; | ||
mx.hostname = mx.hostname || socket.remoteAddress; | ||
options.remoteAddress = socket.remoteAddress; | ||
return resolve(mx); | ||
}); | ||
); | ||
socket.once('error', err => { | ||
if (err && !firstError) { | ||
let code = mx.isMX ? 450 : 550; | ||
let code = 450; | ||
err.message = `Network error when connecting to MX server ${mx.hostname}[${mx.host}] for ${delivery.domain}: ${netErrors[err.code] || | ||
@@ -159,0 +162,0 @@ netErrors[err.errno] || |
{ | ||
"name": "mx-connect", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Establish TCP connection to a MX server", | ||
@@ -13,3 +13,7 @@ "main": "lib/mx-connect.js", | ||
}, | ||
"keywords": ["mx", "smtp", "mta"], | ||
"keywords": [ | ||
"mx", | ||
"smtp", | ||
"mta" | ||
], | ||
"author": "Andris Reinman", | ||
@@ -23,10 +27,10 @@ "license": "EUPL-1.1+", | ||
"eslint-config-nodemailer": "^1.2.0", | ||
"grunt": "^1.0.2", | ||
"grunt-cli": "^1.2.0", | ||
"grunt": "^1.0.3", | ||
"grunt-cli": "^1.3.0", | ||
"grunt-contrib-nodeunit": "^2.0.0", | ||
"grunt-eslint": "^20.1.0" | ||
"grunt-eslint": "^21.0.0" | ||
}, | ||
"dependencies": { | ||
"ipaddr.js": "^1.7.0" | ||
"ipaddr.js": "^1.8.1" | ||
} | ||
} |
53550
915
Updatedipaddr.js@^1.8.1