@nohost/connect
Advanced tools
Comparing version 1.1.1 to 1.2.0
15
index.js
@@ -24,3 +24,3 @@ const http = require('http'); | ||
if (cb) { | ||
cb(err || CLOSED_ERR); | ||
cb(err); | ||
cb = null; | ||
@@ -30,3 +30,3 @@ } | ||
if (req._hasError) { | ||
return cb && cb(CLOSED_ERR); | ||
return cb && cb(); | ||
} | ||
@@ -50,3 +50,3 @@ req.on('error', execCb); | ||
}; | ||
const handleError = function(err) { | ||
const handleError = (err) => { | ||
clearTimeout(timer); | ||
@@ -56,3 +56,3 @@ if (done) { | ||
} | ||
err = err || (this === socket ? CLOSED_ERR : TIMEOUT_ERR); | ||
err = err || TIMEOUT_ERR; | ||
if (retry) { | ||
@@ -73,3 +73,3 @@ return execCallback(err); | ||
} | ||
onClose(socket, handleError); | ||
onClose(socket, err => handleError(err || CLOSED_ERR)); | ||
}; | ||
@@ -130,3 +130,3 @@ | ||
_destroy(err); | ||
reject(err); | ||
reject(err || CLOSED_ERR); | ||
}); | ||
@@ -191,3 +191,4 @@ }); | ||
onClose(reqSock, (e) => socket.destroy(e)); | ||
onClose(socket, (e) => reqSock.destroy(e)); | ||
// 出错才可以把客户端连接销毁,否则会有问题 | ||
onClose(socket, (e) => e && reqSock.destroy(e)); | ||
} catch (e) { | ||
@@ -194,0 +195,0 @@ const body = e.stack || e.message || ''; |
{ | ||
"name": "@nohost/connect", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "处理 Nohost 内部请求转发的模块", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7467
187