lib/command/server/client.js
function kill(req, res) {
  // TODO: implement filters
  var conn;
  // single ip:port
  if(req.args.length === 1) {
    conn = req.args[0];

    // shouldn't get here, however there is a possible
    // race condition whereby the target connection quits
    // between validate and execute
    if(!conn) return res.send(null, null);

    // suicide
    if(conn.id === req.conn.id) {
      conn.write(Constants.OK, function onWrite() {
        conn.close();
      })
    // killing another connection
    }else{
      //console.dir('closing another connection...');
      conn.close(function onClose() {
        res.send(null, Constants.OK);
      })
    }
  }
}
function kill(req, res) {
  // TODO: implement filters
  var conn;
  // single ip:port
  if(req.args.length === 1) {
    conn = req.args[0];

    // shouldn't get here, however there is a possible
    // race condition whereby the target connection quits
    // between validate and execute
    if(!conn) return res.send(null, null);

    // suicide
    if(conn.id === req.conn.id) {
      conn.write(Constants.OK, function onWrite() {
        conn.close();
      })
    // killing another connection
    }else{
      //console.dir('closing another connection...');
      conn.close(function onClose() {
        res.send(null, Constants.OK);
      })
    }
  }
}
function kill ( req , res ) { // TODO: implement filters var conn ; // single ip:port if ( req . args . length === 1 ) { conn = req . args [ 0 ] ; // shouldn't get here, however there is a possible // race condition whereby the target connection quits // between validate and execute if ( ! conn ) return res . send ( null , null ) ; // suicide if ( conn . id === req . conn . id ) { conn . write ( Constants . OK , function onWrite ( ) { conn . close ( ) ; } ) // killing another connection } else { //console.dir('closing another connection...'); conn . close ( function onClose ( ) { res . send ( null , Constants . OK ) ; } ) } } }
Respond to the KILL subcommand.
Respond to the KILL subcommand .