代理连接超时时,关闭客户端连接。
parent
5919441bac
commit
2b8acc2507
|
@ -86,13 +86,17 @@ function connect (req, cltSocket, head, hostname, port, dnsConfig/* , sniRegexpM
|
||||||
const cost = new Date() - start
|
const cost = new Date() - start
|
||||||
const errorMsg = `代理连接超时: ${hostport}, cost: ${cost} ms`
|
const errorMsg = `代理连接超时: ${hostport}, cost: ${cost} ms`
|
||||||
log.error(errorMsg)
|
log.error(errorMsg)
|
||||||
|
|
||||||
|
cltSocket.destroy()
|
||||||
})
|
})
|
||||||
proxySocket.on('error', (e) => {
|
proxySocket.on('error', (e) => {
|
||||||
// 连接失败,可能被GFW拦截,或者服务端拥挤
|
// 连接失败,可能被GFW拦截,或者服务端拥挤
|
||||||
const cost = new Date() - start
|
const cost = new Date() - start
|
||||||
const errorMsg = `代理连接失败: ${hostport}, cost: ${cost} ms, errorMsg: ${e.message}`
|
const errorMsg = `代理连接失败: ${hostport}, cost: ${cost} ms, errorMsg: ${e.message}`
|
||||||
log.error(errorMsg)
|
log.error(errorMsg)
|
||||||
|
|
||||||
cltSocket.destroy()
|
cltSocket.destroy()
|
||||||
|
|
||||||
if (isDnsIntercept && isDnsIntercept.dns && isDnsIntercept.ip !== isDnsIntercept.hostname) {
|
if (isDnsIntercept && isDnsIntercept.dns && isDnsIntercept.ip !== isDnsIntercept.hostname) {
|
||||||
const { dns, ip, hostname } = isDnsIntercept
|
const { dns, ip, hostname } = isDnsIntercept
|
||||||
dns.count(hostname, ip, true)
|
dns.count(hostname, ip, true)
|
||||||
|
|
Loading…
Reference in New Issue