felixge / node-couchdb

A new CouchDB module following node.js idioms
MIT License
364 stars 71 forks source link

cb firing multiple times #50

Open lperrin opened 11 years ago

lperrin commented 11 years ago

Near line 178, this code doesn't set cbFired to true:

onError = function(reason) {
        if (!cbFired && typeof cb === 'function') {
          cb(new Error(reason));
        }
      },
      onClose = function() {
        if (!cbFired && typeof cb === 'function') {
          cb();
        }
      },

If a TCP error occurs, the callback is called twice.

felixge commented 11 years ago

@lperrin I just made you a contributor on github, feel free to push your suggested fix!

lperrin commented 11 years ago

I'll do that, thanks :)