static count(cb) { db.llen('entries', cb); }
app.get('/listservers', function(req,res){ client.lrange('serverList', 0, -1, function(err, reply) { if(reply){ client.llen('serverList', function(err, reply){ if (!err) { console.log("LLEN "+reply); } }); value = 'Recently added servers:\n'; res.send(value + reply); } else{ res.send('No Servers foundin the list') } }); })
app.get('/destroy', function(req,res) { client.llen('serverList',function(err,reply) { console.log(reply); var len = reply; var port = 0; console.log('Length:' + len); var index = Math.floor(Math.random()*len); client.lrange('serverList',index,index,function(err, reply) { port = reply console.log('Stoping server on port : ' + port); if(port == defPort){ console.log('will not stop the default server'); res.send('will not stop the default server'); } else { client.lrem('serverList',1,port,function(err, reply) { create_process('sh',['kill_server.sh',port]); res.send('Success stopped the server at port : ' + port); console.log('Success stopped the server at port : ' + port); }); } }); }); })
app.get('/spawn', function(req,res) { console.log("Old port "+port); client.llen('serverList', function(err, reply){ if (!err) { port = port+reply+1 console.log(port); } }); console.log("New port "+port); client.lpush('serverList',port); client.llen('serverList', function(err, reply){ if (!err) { console.log("LLEN "+reply); } }); create_process('sh',['spawn_server.sh',port]); res.send("Started a new server on port " + port + " succesfully"); })
static count(cb) { db.llen('entries', cb); }
static count(cb) { db.llen('entries', cb); }
static count(cb) { db.llen('entries', cb); }
static count(cb) { db.llen('entries', cb); }
static count(cb) { db.llen('entries', cb); }
static count(cb) { db.llen('entries', cb); }
static count(cb) { db.llen('entries', cb); }
static count(cb) { db.llen('entries', cb); }