Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit

Permalink
Kills server before deleting
Browse files Browse the repository at this point in the history
Replaces old kill function with better one.
Kills a server before deletion
Removed useless variable
  • Loading branch information
koo04 committed Dec 7, 2014
1 parent 855e4b1 commit 355d160
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions interfaces/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ restserver.del('/gameservers/:id', function info(req, res, next){
if (!restauth(req, req.params.id, "g:delete")){res = unauthorized(res); return next();}
service = servers[req.params.id];
// TODO: if on, turn off
service.delete(); var ftpd = require('ftpd');
service.delete();
id = config.servers.splice(req.params.id,1);
saveconfig(config);
res.send("ok");
Expand Down Expand Up @@ -167,7 +167,7 @@ restserver.get('/gameservers/:id/off', function off(req, res, next){
restserver.get('/gameservers/:id/kill', function off(req, res, next){
if (!restauth(req, req.params.id, "s:power")){res = unauthorized(res); return next();}
service = servers[req.params.id];
service.killpid();
service.kill();
res.send('ok')
});

Expand Down
7 changes: 2 additions & 5 deletions services/gameprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ GameServer.prototype.turnoff = function(){
}
};

GameServer.prototype.killpid = function(){
GameServer.prototype.kill = function(){
var self = this;
clearTimeout(self.queryCheck);
if (!self.status == OFF){
Expand Down Expand Up @@ -216,6 +216,7 @@ GameServer.prototype.create = function(){

GameServer.prototype.delete = function(){
console.log("-----Deleting Server " + this.config.name + "-----");
this.kill();
deleteUser(this.config.user, function cb(){callback(null);});
console.log("----------")
};
Expand Down Expand Up @@ -268,10 +269,6 @@ GameServer.prototype.restart = function(){
this.turnoff();
};

GameServer.prototype.kill = function(){
this.ps.kill();
};

GameServer.prototype.send = function(data){
if (this.status == ON || this.status == STARTING){
this.ps.write(data + '\n');
Expand Down

0 comments on commit 355d160

Please sign in to comment.