aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io/channel-websock.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/io/channel-websock.c b/io/channel-websock.c
index e47279a1ae..a06a4a85d1 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -570,21 +570,24 @@ static ssize_t qio_channel_websock_read_wire(QIOChannelWebsock *ioc,
ioc->encinput.offset += ret;
}
- if (ioc->payload_remain == 0) {
- ret = qio_channel_websock_decode_header(ioc, errp);
+ while (ioc->encinput.offset != 0) {
+ if (ioc->payload_remain == 0) {
+ ret = qio_channel_websock_decode_header(ioc, errp);
+ if (ret < 0) {
+ return ret;
+ }
+ if (ret == 0) {
+ ioc->io_eof = TRUE;
+ break;
+ }
+ }
+
+ ret = qio_channel_websock_decode_payload(ioc, errp);
if (ret < 0) {
return ret;
}
- if (ret == 0) {
- return 0;
- }
}
-
- ret = qio_channel_websock_decode_payload(ioc, errp);
- if (ret < 0) {
- return ret;
- }
- return ret;
+ return 1;
}
@@ -642,9 +645,6 @@ static gboolean qio_channel_websock_flush(QIOChannel *ioc,
if (ret < 0) {
goto cleanup;
}
- if (ret == 0) {
- wioc->io_eof = TRUE;
- }
}
cleanup: