qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] char: ensure all clients are in non-blocking mode
@ 2016-03-18 18:00 Daniel P. Berrange
  2016-03-19  9:12 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel P. Berrange @ 2016-03-18 18:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Paolo Bonzini, Andrew Baumann

Only some callers of tcp_chr_new_client are putting the
socket client into non-blocking mode. Move the call to
qio_channel_set_blocking() into the tcp_chr_new_client
method to guarantee that all code paths set non-blocking
mode

Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Reported-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 qemu-char.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qemu-char.c b/qemu-char.c
index bfcf80d..144764e 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3071,6 +3071,8 @@ static int tcp_chr_new_client(CharDriverState *chr, QIOChannelSocket *sioc)
     s->sioc = sioc;
     object_ref(OBJECT(sioc));
 
+    qio_channel_set_blocking(s->ioc, false, NULL);
+
     if (s->do_nodelay) {
         qio_channel_set_delay(s->ioc, false);
     }
@@ -3102,7 +3104,6 @@ static int tcp_chr_add_client(CharDriverState *chr, int fd)
     if (!sioc) {
         return -1;
     }
-    qio_channel_set_blocking(QIO_CHANNEL(sioc), false, NULL);
     ret = tcp_chr_new_client(chr, sioc);
     object_unref(OBJECT(sioc));
     return ret;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] char: ensure all clients are in non-blocking mode
  2016-03-18 18:00 [Qemu-devel] [PATCH] char: ensure all clients are in non-blocking mode Daniel P. Berrange
@ 2016-03-19  9:12 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-03-19  9:12 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: Laurent Vivier, Andrew Baumann



On 18/03/2016 19:00, Daniel P. Berrange wrote:
> Only some callers of tcp_chr_new_client are putting the
> socket client into non-blocking mode. Move the call to
> qio_channel_set_blocking() into the tcp_chr_new_client
> method to guarantee that all code paths set non-blocking
> mode
> 
> Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> Reported-by: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  qemu-char.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index bfcf80d..144764e 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -3071,6 +3071,8 @@ static int tcp_chr_new_client(CharDriverState *chr, QIOChannelSocket *sioc)
>      s->sioc = sioc;
>      object_ref(OBJECT(sioc));
>  
> +    qio_channel_set_blocking(s->ioc, false, NULL);
> +
>      if (s->do_nodelay) {
>          qio_channel_set_delay(s->ioc, false);
>      }
> @@ -3102,7 +3104,6 @@ static int tcp_chr_add_client(CharDriverState *chr, int fd)
>      if (!sioc) {
>          return -1;
>      }
> -    qio_channel_set_blocking(QIO_CHANNEL(sioc), false, NULL);
>      ret = tcp_chr_new_client(chr, sioc);
>      object_unref(OBJECT(sioc));
>      return ret;
> 

Thanks, queued.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-19  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18 18:00 [Qemu-devel] [PATCH] char: ensure all clients are in non-blocking mode Daniel P. Berrange
2016-03-19  9:12 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).