Cleanup the ping action handler

master
Daniel Berteaud 11 years ago
parent 9c89212fbb
commit e00e0f7605
  1. 18
      public/vroom.pl

@ -529,28 +529,24 @@ post '/action' => sub {
);
}
elsif ($action eq 'ping'){
my $status = 'error';
my $msg = 'ERROR_OCCURED';
my $res = $self->ping_room($room);
# Cleanup expired rooms every ~10 pings
if ((int (rand 100)) <= 10){
$self->delete_rooms;
}
if (!$res){
return $self->render(
json => {
msg => $self->l('ERROR_OCCURED'),
status => 'error'
},
);
if ($res){
$status = 'success';
$msg = '';
}
else{
return $self->render(
json => {
msg => '',
status => 'success'
msg => $msg,
status => $status
}
);
}
}
elsif ($action eq 'setPassword'){
my $pass = $self->param('password');
my $type = $self->param('type') || 'join';

Loading…
Cancel
Save