lib/commands/bridge/index.js
function bridgeCommand(command,cb){
    if(!connected) return setImmediate(function(){
      cb('killed');
    });

    if(!connected.pings) connected.pings = {};
    var id = ++pingid;
    var timer;
    connected.pings[id] = function(err,data){
      clearTimeout(timer);
      delete connected.pings[id]
      cb(err,data);
    };
    connected.send({command:command,cb:id});
    // set 5 second time limit for callback.
    timer = setTimeout(function(){
      cb("timeout");
    },5000);
  }
function bridgeCommand(command,cb){
    if(!connected) return setImmediate(function(){
      cb('killed');
    });

    if(!connected.pings) connected.pings = {};
    var id = ++pingid;
    var timer;
    connected.pings[id] = function(err,data){
      clearTimeout(timer);
      delete connected.pings[id]
      cb(err,data);
    };
    connected.send({command:command,cb:id});
    // set 5 second time limit for callback.
    timer = setTimeout(function(){
      cb("timeout");
    },5000);
  }
function bridgeCommand ( command , cb ) { if ( ! connected ) return setImmediate ( function ( ) { cb ( 'killed' ) ; } ) ; if ( ! connected . pings ) connected . pings = { } ; var id = ++ pingid ; var timer ; connected . pings [ id ] = function ( err , data ) { clearTimeout ( timer ) ; delete connected . pings [ id ] cb ( err , data ) ; } ; connected . send ( { command : command , cb : id } ) ; // set 5 second time limit for callback. timer = setTimeout ( function ( ) { cb ( "timeout" ) ; } , 5000 ) ; }
rpc to worker process for commands.
rpc to worker process for commands .