lib/statsd.js
function onSend(error, bytes) {
    completed += 1;
    if (calledback) {
      return;
    }

    if (error) {
      if (typeof callback === 'function') {
        calledback = true;
        callback(error);
      } else if (self.errorHandler) {
        calledback = true;
        self.errorHandler(error);
      }
      return;
    }

    if (bytes) {
      sentBytes += bytes;
    }

    if (completed === stat.length && typeof callback === 'function') {
      callback(null, sentBytes);
    }
  }
function onSend(error, bytes) {
    completed += 1;
    if (calledback) {
      return;
    }

    if (error) {
      if (typeof callback === 'function') {
        calledback = true;
        callback(error);
      } else if (self.errorHandler) {
        calledback = true;
        self.errorHandler(error);
      }
      return;
    }

    if (bytes) {
      sentBytes += bytes;
    }

    if (completed === stat.length && typeof callback === 'function') {
      callback(null, sentBytes);
    }
  }
function onSend ( error , bytes ) { completed += 1 ; if ( calledback ) { return ; } if ( error ) { if ( typeof callback === 'function' ) { calledback = true ; callback ( error ) ; } else if ( self . errorHandler ) { calledback = true ; self . errorHandler ( error ) ; } return ; } if ( bytes ) { sentBytes += bytes ; } if ( completed === stat . length && typeof callback === 'function' ) { callback ( null , sentBytes ) ; } }
Gets called once for each callback, when all callbacks return we will
call back from the function
@private
Gets called once for each callback when all callbacks return we will call back from the function