New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug of socket CLOSE_WAIT #21

Closed
wants to merge 1 commit into
base: master
from
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Diff settings

Always

Just for now

fix bug of socket CLOSE_WAIT

  • Loading branch information...
mike442144 committed Dec 22, 2016
commit 6218c612d005d0cbab3cf133ccd20b9a21a2aa4d
View
@@ -138,20 +138,20 @@ TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
function onConnect(res, socket, head) {
connectReq.removeAllListeners();
socket.removeAllListeners();
self.sockets[self.sockets.indexOf(placeholder)] = socket
if (res.statusCode === 200) {
assert.equal(head.length, 0);
debug('tunneling connection has established');
self.sockets[self.sockets.indexOf(placeholder)] = socket;
cb(socket);
} else {
debug('tunneling socket could not be established, statusCode=%d',
res.statusCode);
var error = new Error('tunneling socket could not be established, ' +
'statusCode=' + res.statusCode);
error.code = 'ECONNRESET';
cb(socket)
options.request.emit('error', error);
self.removeSocket(placeholder);
}
}
ProTip! Use n and p to navigate between commits in a pull request.