mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-07-09 03:31:02 +00:00
qmp_read_avail : reworks
qmp response could me more than 1 json. we can have 1 json with event info, and 1 json with return infos. We die if we receive an error message in response. Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
parent
35cb731c42
commit
f667373f27
@ -2702,8 +2702,20 @@ my $qmp_read_avail = sub {
|
||||
}
|
||||
|
||||
die "qmp read timeout\n" if !scalar(@ready);
|
||||
my $obj = from_json($res);
|
||||
return $obj;
|
||||
|
||||
my @jsons = split("\n", $res);
|
||||
my $obj = {};
|
||||
my $event = {};
|
||||
my $return = {};
|
||||
foreach my $json (@jsons) {
|
||||
$obj = from_json($json);
|
||||
$event = $obj->{event} if exists $obj->{event};
|
||||
$return = $obj->{QMP} if exists $obj->{QMP};
|
||||
$return = $obj->{"return"} if exists $obj->{"return"};
|
||||
die $obj->{error}->{desc} if exists $obj->{error}->{desc} && $obj->{error}->{desc} !~ m/Connection can not be completed immediately/;
|
||||
}
|
||||
|
||||
return ($return,$event);
|
||||
};
|
||||
|
||||
sub __read_avail {
|
||||
|
Loading…
Reference in New Issue
Block a user