summaryrefslogtreecommitdiff
path: root/chardev
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-07-06 19:03:53 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2017-07-14 11:04:33 +0200
commitbcdeb9be566ded2eb35233aaccf38742a21e5daa (patch)
tree20c0d1377d188c1f42276b09e757f49e64222b67 /chardev
parent747969db2a6cd6e93561f7edc50d824a7d67346b (diff)
chardev: block during sync read
A sync read should block until all requested data is available (instead of retrying in qemu_chr_fe_read_all). Change the channel to blocking during sync_read. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170706170353.32601-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'chardev')
-rw-r--r--chardev/char-socket.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index ccc499cfa1..7e6648b03a 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -454,7 +454,9 @@ static int tcp_chr_sync_read(Chardev *chr, const uint8_t *buf, int len)
return 0;
}
+ qio_channel_set_blocking(s->ioc, true, NULL);
size = tcp_chr_recv(chr, (void *) buf, len);
+ qio_channel_set_blocking(s->ioc, false, NULL);
if (size == 0) {
/* connection closed */
tcp_chr_disconnect(chr);