All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: "Krumme, Chris" <Chris.Krumme@windriver.com>
Cc: Ian Molton <ian.molton@collabora.co.uk>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Socket reconnection.
Date: Tue, 01 Dec 2009 12:54:42 -0600	[thread overview]
Message-ID: <4B156672.1010008@codemonkey.ws> (raw)
In-Reply-To: <58BD0469C48A7443A479A13D101685E30380B88A@ala-mail09.corp.ad.wrs.com>

Krumme, Chris wrote:
> Hello Ian,
>
> Since you did not inline your source I will paste in a chunk:
>
>
> @@ -2030,10 +2036,18 @@ static void tcp_chr_read(void *opaque)
>          if (s->listen_fd >= 0) {
>              qemu_set_fd_handler(s->listen_fd, tcp_chr_accept, NULL,
> chr);
>          }
> -        qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
> +        if (!s->reconnect)
> +            qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
>          closesocket(s->fd);
>          s->fd = -1;
> -        qemu_chr_event(chr, CHR_EVENT_CLOSED);
> +        if (!s->reconnect) {
> +            qemu_chr_event(chr, CHR_EVENT_CLOSED);
> +        } else {
> +            do {
> +                sleep(s->reconnect);
> +            } while(!qemu_chr_connect_socket(s));
> +            qemu_chr_event(chr, CHR_EVENT_RECONNECTED);
> +        }
>      } else if (size > 0) {
>          if (s->do_telnetopt)
>              tcp_chr_process_IAC_bytes(chr, s, buf, &size);
>
>
> Should you be introducing a while sleep loop into Qemu here?
>
> I would think you should be returning 'no data', maybe after trying
> once.
>
> Hope this helps.
>
> Chris
>   

sleep() in qemu is very, very wrong.  It will pause the guest's 
execution and all sorts of badness can ensue.

The right thing to do is set a timer and not generate data while 
disconnected.  I still am not confident this is really a great thing to do.

Regards,

Anthony Liguori

  parent reply	other threads:[~2009-12-01 18:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26  0:31 [Qemu-devel] Socket reconnection Ian Molton
2009-11-26  9:21 ` Gerd Hoffmann
2009-11-27  9:01 ` Jamie Lokier
2009-12-01 11:55   ` Ian Molton
2009-12-06 14:32     ` Jamie Lokier
2009-12-06 16:33       ` Ian Molton
2009-12-07  2:29         ` Jamie Lokier
2009-12-07  9:29           ` Ian Molton
2009-11-30 17:18 ` Anthony Liguori
2009-12-01 11:54   ` Ian Molton
2009-12-01 14:38     ` Krumme, Chris
2009-12-01 18:29       ` Ian Molton
2009-12-01 18:54       ` Anthony Liguori [this message]
2009-12-02 10:40         ` Ian Molton
2009-12-02 12:04           ` [Qemu-devel] " Jan Kiszka
2009-12-02 19:56           ` [Qemu-devel] " Anthony Liguori
2009-12-02 22:35           ` Krumme, Chris
2009-12-03 10:04             ` Ian Molton
2009-12-03 10:23               ` Kevin Wolf
2009-12-03 14:22               ` Anthony Liguori
2009-12-03 18:37                 ` [Qemu-devel] [PATCH]Socket reconnection Ian Molton
2009-12-05 22:03                   ` Ian Molton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B156672.1010008@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=Chris.Krumme@windriver.com \
    --cc=ian.molton@collabora.co.uk \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.