Prevent uninit value being logged

master
Daniel Berteaud 9 years ago
parent df6b375f8c
commit 211800e6dc
  1. 10
      vroom.pl

@ -1335,10 +1335,12 @@ websocket '/socket.io/:ver/websocket/:id' => sub {
# Triggerred when a websocket connection ends # Triggerred when a websocket connection ends
$self->on(finish => sub { $self->on(finish => sub {
my ($self, $code, $reason) = @_; my ($self, $code, $reason) = @_;
$self->log_event({ if ($id && $peers->{$id} && $peers->{$id}->{room}){
event => 'room_leave', $self->log_event({
msg => "Peer $id closed websocket connection, leaving room " . $peers->{$id}->{room} event => 'room_leave',
}); msg => "Peer $id closed websocket connection, leaving room " . $peers->{$id}->{room}
});
}
$self->signal_broadcast_room({ $self->signal_broadcast_room({
from => $id, from => $id,
msg => Protocol::SocketIO::Message->new( msg => Protocol::SocketIO::Message->new(

Loading…
Cancel
Save