QMPClient: add destructor

Explicitly close leftover connections in the destructor,
otherwise the IO::Multiplex instance can be leaked causing
the qmp connection to never be closed.

This could occur for instance when cancelling vzdump with
ctrl+c with extremely unlucky timing...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-10-30 10:28:24 +01:00 committed by Thomas Lamprecht
parent 73a4470a8f
commit 56afd466dd

View File

@ -509,4 +509,13 @@ sub mux_eof {
}
}
sub DESTROY {
my ($self) = @_;
foreach my $sname (keys %{$self->{queue_info}}) {
my $queue_info = $self->{queue_info}->{$sname};
$close_connection->($self, $queue_info);
}
}
1;