lib/Connection.js
function(params, callback) {
      callback = callback || function(){};
      var t = this,
          errorText = '',
          logId = t.logId + 'probeControl',
          startTime = Date.now(),
          router = Monitor.getRouter(),
          firewall = t.get('firewall');

      // Don't allow inbound requests if this connection is firewalled
      if (firewall) {
        errorText = 'firewalled';
        log.error(logId, errorText);
        return callback(errorText);
      }

      // Called upon return
      var onReturn = function(error) {
        if (error) {
          log.error(logId, error);
          return callback(error);
        }
        else {
          var duration = Date.now() - startTime;
          log.info(logId + '.return', {duration:duration, returnArgs: arguments});
          stat.time(logId, duration);
          return callback.apply(null, arguments);
        }
      };

      // Is this an internal probe?
      var probe = router.runningProbesById[params.probeId];
      if (!probe) {

        // Is this a remote (proxied) probe?
        var monitorProxy = t.incomingMonitorsById[params.probeId];
        if (!monitorProxy) {
          errorText = 'Probe id not found: ' + params.probeId;
          log.error(errorText);
          return callback(errorText);
        }

        // Proxying requires this form vs. callback as last arg.
        return monitorProxy.control(params.name, params.params, function(err, returnParams) {
          onReturn(err, returnParams);
        });
      }
      logId = logId + '.' + probe.probeClass + '.' + params.name;
      log.info(logId + '.request', {params:params.params, probeId:params.probeId});
      return probe.onControl(params.name, params.params, onReturn);
    }
function(params, callback) {
      callback = callback || function(){};
      var t = this,
          errorText = '',
          logId = t.logId + 'probeControl',
          startTime = Date.now(),
          router = Monitor.getRouter(),
          firewall = t.get('firewall');

      // Don't allow inbound requests if this connection is firewalled
      if (firewall) {
        errorText = 'firewalled';
        log.error(logId, errorText);
        return callback(errorText);
      }

      // Called upon return
      var onReturn = function(error) {
        if (error) {
          log.error(logId, error);
          return callback(error);
        }
        else {
          var duration = Date.now() - startTime;
          log.info(logId + '.return', {duration:duration, returnArgs: arguments});
          stat.time(logId, duration);
          return callback.apply(null, arguments);
        }
      };

      // Is this an internal probe?
      var probe = router.runningProbesById[params.probeId];
      if (!probe) {

        // Is this a remote (proxied) probe?
        var monitorProxy = t.incomingMonitorsById[params.probeId];
        if (!monitorProxy) {
          errorText = 'Probe id not found: ' + params.probeId;
          log.error(errorText);
          return callback(errorText);
        }

        // Proxying requires this form vs. callback as last arg.
        return monitorProxy.control(params.name, params.params, function(err, returnParams) {
          onReturn(err, returnParams);
        });
      }
      logId = logId + '.' + probe.probeClass + '.' + params.name;
      log.info(logId + '.request', {params:params.params, probeId:params.probeId});
      return probe.onControl(params.name, params.params, onReturn);
    }
function ( params , callback ) { callback = callback || function ( ) { } ; var t = this , errorText = '' , logId = t . logId + 'probeControl' , startTime = Date . now ( ) , router = Monitor . getRouter ( ) , firewall = t . get ( 'firewall' ) ; // Don't allow inbound requests if this connection is firewalled if ( firewall ) { errorText = 'firewalled' ; log . error ( logId , errorText ) ; return callback ( errorText ) ; } // Called upon return var onReturn = function ( error ) { if ( error ) { log . error ( logId , error ) ; return callback ( error ) ; } else { var duration = Date . now ( ) - startTime ; log . info ( logId + '.return' , { duration : duration , returnArgs : arguments } ) ; stat . time ( logId , duration ) ; return callback . apply ( null , arguments ) ; } } ; // Is this an internal probe? var probe = router . runningProbesById [ params . probeId ] ; if ( ! probe ) { // Is this a remote (proxied) probe? var monitorProxy = t . incomingMonitorsById [ params . probeId ] ; if ( ! monitorProxy ) { errorText = 'Probe id not found: ' + params . probeId ; log . error ( errorText ) ; return callback ( errorText ) ; } // Proxying requires this form vs. callback as last arg. return monitorProxy . control ( params . name , params . params , function ( err , returnParams ) { onReturn ( err , returnParams ) ; } ) ; } logId = logId + '.' + probe . probeClass + '.' + params . name ; log . info ( logId + '.request' , { params : params . params , probeId : params . probeId } ) ; return probe . onControl ( params . name , params . params , onReturn ) ; }
Process an inbound control request to a probe

@method probeControl
@protected
@param params {Object} Control parameters, including:
probeId {String} The unique probe id
name {String} The control message name
params {Object} Any control message parameters
@param callback {Function(error, returnParams)} Callback function
Process an inbound control request to a probe