mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-06-18 12:10:21 +00:00
mtunnel: add and handle OK/ERR replies
because we want commands to return meaningful errors, and print them on the client/source side. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
79c9e07933
commit
bcb51ae8f9
@ -277,7 +277,10 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
while (my $line = <>) {
|
while (my $line = <>) {
|
||||||
chomp $line;
|
chomp $line;
|
||||||
last if $line =~ m/^quit$/;
|
if ($line =~ /^quit$/) {
|
||||||
|
$tunnel_write->("OK");
|
||||||
|
last;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
|
@ -123,6 +123,17 @@ sub write_tunnel {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
die "writing to tunnel failed: $@\n" if $@;
|
die "writing to tunnel failed: $@\n" if $@;
|
||||||
|
|
||||||
|
if ($tunnel->{version} && $tunnel->{version} >= 1) {
|
||||||
|
my $res = eval { $self->read_tunnel($tunnel, 10); };
|
||||||
|
die "no reply to command '$command': $@\n" if $@;
|
||||||
|
|
||||||
|
if ($res eq 'OK') {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
die "tunnel replied '$res' to command '$command'\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub fork_tunnel {
|
sub fork_tunnel {
|
||||||
|
Loading…
Reference in New Issue
Block a user