diff --git a/PVE/APIServer/AnyEvent.pm b/PVE/APIServer/AnyEvent.pm index fbc500f..6e7d4ad 100755 --- a/PVE/APIServer/AnyEvent.pm +++ b/PVE/APIServer/AnyEvent.pm @@ -146,10 +146,11 @@ sub client_do_disconnect { sub finish_response { my ($self, $reqstate) = @_; - my $hdl = $reqstate->{hdl}; - cleanup_reqstate($reqstate); + my $hdl = $reqstate->{hdl}; + return if !$hdl; # already disconnected + if (!$self->{end_loop} && $reqstate->{keep_alive} > 0) { # print "KEEPALIVE $reqstate->{keep_alive}\n" if $self->{debug}; $hdl->on_read(sub {