Skip to content

Commit

Permalink
Support custom agent with keepAlive: true & maxSockets set
Browse files Browse the repository at this point in the history
  • Loading branch information
kesla committed Apr 2, 2018
1 parent bc8d7be commit 3bbffa1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/StripeResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,17 @@ StripeResource.prototype = {
req.on('error', self._errorHandler(req, callback));

req.on('socket', function(socket) {
socket.on((isInsecureConnection ? 'connect' : 'secureConnect'), function() {
// Send payload; we're safe:
if (socket.connecting) {
socket.on((isInsecureConnection ? 'connect' : 'secureConnect'), function() {
// Send payload; we're safe:
req.write(requestData);
req.end();
});
} else {
// we're already connected
req.write(requestData);

req.end();
});
}
});
}
},
Expand Down

0 comments on commit 3bbffa1

Please sign in to comment.