Skip to content

Commit

Permalink
clean up connections a little more consistently (closes #715)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 9, 2014
1 parent 4b7c743 commit 092b5da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -70,15 +70,15 @@ sub websocket {

sub _cleanup {
my $self = shift;
return unless my $loop = $self->_loop(0);
return $self unless my $loop = $self->_loop(0);

# Clean up active connections (by closing them)
delete $self->{pid};
$self->_finish($_, 1) for keys %{$self->{connections} || {}};

# Clean up keep-alive connections
$loop->remove($_->[1]) for @{delete $self->{queue} || []};
$loop = $self->_loop(1);
return $self unless $loop = $self->_loop(1);
$loop->remove($_->[1]) for @{delete $self->{nb_queue} || []};

return $self;
Expand Down

0 comments on commit 092b5da

Please sign in to comment.