This commit is contained in:
William Mantly 2016-04-25 13:32:16 -04:00
parent 299040be6f
commit 5c91414521

View File

@ -14,7 +14,7 @@ var ip2name = {};
var lxcTimeout = function(ip, time){
var name = ip2name[ip];
console.log(name);
console.log(name)
time = time || 900000; // 15 minutes
var keys = Object.keys(timeoutEvents)
if(keys.indexOf(name) !== -1){
@ -31,14 +31,17 @@ var runner = function(req, res, ip){
console.log('ip:', ip);
lxcTimeout(ip);
console.log('code to run:', '\n'+req.body.code);
return request.post({
url: 'http://'+ip+':15000',
var httpOptions = {
url:'http://' + ip + ':15000',
body: JSON.stringify({
code: req.body.code
})
}, function(error, response, body){
console.log('arguments:\n', arguments);
// body = JSON.parse(body);
};
return request.post(httpOptions, function(error, response, body){
console.log('body:\n', body);
body = JSON.parse(body);
body['ip'] = ip.replace('10.0.', '');
return res.json(body);
});