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.
Near line 178, this code doesn't set cbFired to true:
If a TCP error occurs, the callback is called twice.