qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 5/6] qemu-char: Add reconnecting to client socke


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 5/6] qemu-char: Add reconnecting to client sockets
Date: Wed, 01 Oct 2014 13:10:15 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

On 09/25/2014 02:07 PM, address@hidden wrote:
> From: Corey Minyard <address@hidden>
> 
> Adds a "reconnect" option to socket backends that gives a reconnect
> timeout.  This only applies to client sockets.  If the other end
> of a socket closes the connection, qemu will attempt to reconnect
> after the given number of seconds.
> 
> Signed-off-by: Corey Minyard <address@hidden>
> ---
>  qapi-schema.json | 15 ++++++----
>  qemu-char.c      | 88 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++----
>  qemu-options.hx  | 20 ++++++++-----
>  3 files changed, 105 insertions(+), 18 deletions(-)
> 

>  
> +static gboolean socket_reconnect_timeout(gpointer opaque);
> +

Do you really need a forward declaration of this static function, or can
you just stick the body of the function here?


> @@ -2964,6 +2979,10 @@ static void tcp_chr_close(CharDriverState *chr)
>      TCPCharDriver *s = chr->opaque;
>      int i;
>  
> +    if (s->reconnect_timer) {
> +        g_source_remove(s->reconnect_timer);
> +     s->reconnect_timer = 0;

TAB damage.


> @@ -3023,7 +3063,10 @@ static bool qemu_chr_open_socket_fd(CharDriverState 
> *chr, Error **errp)
>  
>      if (s->is_listen) {
>          fd = socket_listen(s->addr, errp);
> -    } else  {
> +    } else if (s->reconnect_time) {
> +     fd = socket_connect(s->addr, errp, qemu_chr_socket_connected, chr);
> +     return (fd >= 0);

More TAB damage.  Also, the () in the return are not necessary.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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