summaryrefslogtreecommitdiffstats
path: root/io
diff options
context:
space:
mode:
authorDaniel P. Berrangé2019-02-20 19:22:39 +0100
committerDaniel P. Berrangé2019-03-20 17:56:30 +0100
commitdd154c4d9f48a44ad24e13f46033d0f10a05c923 (patch)
tree631956f639cfeb4def77abda251511f9ee5e500a /io
parentUpdate version for v4.0.0-rc0 release (diff)
downloadqemu-dd154c4d9f48a44ad24e13f46033d0f10a05c923.tar.gz
qemu-dd154c4d9f48a44ad24e13f46033d0f10a05c923.tar.xz
qemu-dd154c4d9f48a44ad24e13f46033d0f10a05c923.zip
io: fix handling of EOF / error conditions in websock GSource
We were never reporting the G_IO_HUP event when an end of file was hit on the websocket channel. We also didn't report G_IO_ERR when we hit a fatal error processing the websocket protocol. The latter in particular meant that the chardev code would not notice when an eof/error was encountered on the websocket channel, unless the guest OS happened to trigger a write operation. This meant that once the first client had quit, the chardev would never listen to accept a new client. Fixes launchpad bug 1816819 Acked-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'io')
-rw-r--r--io/channel-websock.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/io/channel-websock.c b/io/channel-websock.c
index dc43dc6bb9..77d30f0e4a 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -1225,12 +1225,18 @@ qio_channel_websock_source_check(GSource *source)
QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)source;
GIOCondition cond = 0;
- if (wsource->wioc->rawinput.offset || wsource->wioc->io_eof) {
+ if (wsource->wioc->rawinput.offset) {
cond |= G_IO_IN;
}
if (wsource->wioc->encoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
cond |= G_IO_OUT;
}
+ if (wsource->wioc->io_eof) {
+ cond |= G_IO_HUP;
+ }
+ if (wsource->wioc->io_err) {
+ cond |= G_IO_ERR;
+ }
return cond & wsource->condition;
}