Skip to content

Commit

Permalink
Merge pull request #55 from andrewdep/node-v0.12
Browse files Browse the repository at this point in the history
Fixes issue #54 ("Cannot read property '0' of undefined on node v 0.12")
  • Loading branch information
mandric committed Aug 17, 2015
2 parents 3aa29cb + dc734d7 commit 50b6ff7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/couchdb.js
Expand Up @@ -217,7 +217,8 @@ exports.createClient = function(port, host, user, pass, maxListeners, secure) {
})
.on('end', function() {
var json;
httpAgent.sockets[host + ':' + port][0].emit("agentRemove");
var socketKey = (httpAgent.getName && httpAgent.getName({host: host, port: port, maxSockets: 1})) || (host + ':' + port + '::');
(httpAgent.sockets[socketKey] || httpAgent.sockets[host + ':' + port])[0].emit("agentRemove");

if(options.responseEncoding == 'binary') {
cbFired = true;
Expand Down

0 comments on commit 50b6ff7

Please sign in to comment.