qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 02/16] qemu-char: Allow a chardev to reconnect i


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 02/16] qemu-char: Allow a chardev to reconnect if disconnected
Date: Wed, 13 Nov 2013 09:55:43 +0100

  Hi,

> Allow a socket that connects to reconnect on a periodic basis if it
> fails to connect at startup or if the connection drops while in use.

> +    chr->backend = i;
> +    chr->recon_time = qemu_opt_get_number(opts, "reconnect", 0);
> +    if (chr->recon_time) {
> +        if (strcmp(qemu_opt_get(opts, "backend"), "socket") != 0) {
> +            g_free(chr);
> +            fprintf(stderr, "chardev: reconnect only supported on 
> sockets\n");
> +            return NULL;
> +        }

I think it would work *much* better to just add a "chr_reconnect"
function pointer to CharDriverState.  You don't need patch #1 then.
Also it avoids backend-specific bits in generic code.  Generic code just
checks if chr->chr_reconnect exists to figure whenever reconnect is
supported or not.  And the socket backend can set chr_reconnect for
client sockets only.

cheers,
  Gerd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]