On 8/23/19 7:40 PM, Roman Bolshakov wrote:
On Fri, Aug 23, 2019 at 03:33:36PM +0200, Michal Privoznik wrote:
> Currently, whenever there's a regular EOF on the console stream
> or an error the virStreamAbort() is called regardless. While this
> may not actually break anything, we should call virStreamFinish()
> to let the daemon know we've successfully received all the data
> and are shutting down the stream gracefully.
>
> Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
> ---
> tools/virsh-console.c | 41 +++++++++++++++++++++++++----------------
> 1 file changed, 25 insertions(+), 16 deletions(-)
>
> diff --git a/tools/virsh-console.c b/tools/virsh-console.c
> index a235a9a283..900faa5087 100644
> --- a/tools/virsh-console.c
> +++ b/tools/virsh-console.c
> @@ -193,7 +202,7 @@ virConsoleEventOnStream(virStreamPtr st,
> if (done == -2)
> goto cleanup; /* blocking */
> if (done < 0) {
> - virConsoleShutdown(con);
> + virConsoleShutdown(con, done == 0);
> goto cleanup;
> }
> memmove(con->terminalToStream.data,
done is always non-zero here. If that's expected, a constant would be a
bit more cleaner here to sign explicit abort, rather than conditional.
Ah, good point.
Reviewed-by: Roman Bolshakov <r.bolshakov(a)yadro.com>
Thanks, I've pushed this.
Michal