Skip to content

Commit

Permalink
Merge pull request #1 from tobyattagman/fix-test-connection-interrupt…
Browse files Browse the repository at this point in the history
…-node-0.10

the test works in node 0.8 but in 0.10.15 the cbProxy is called twice be...
  • Loading branch information
tobyattagman committed Aug 27, 2013
2 parents d0e25ef + 1195fa3 commit 75680f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/LazySocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ LazySocket.prototype.write = function(/* data, encoding, cb */) {
if (typeof cb === 'function') {
var cbProxy = function() {
var index = self._callbacks.indexOf(cbProxy);

if (index < 0) {
// callback has already been called and removed from the
// callback list
return;
}

self._callbacks.splice(index, 1);

return cb.apply(this, arguments);
Expand Down

0 comments on commit 75680f6

Please sign in to comment.