diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2017-10-09 15:34:06 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2017-10-16 16:57:08 +0100 |
commit | 57b0cdf152b7266e68bfa3e84635d4bdb64ef2cd (patch) | |
tree | a8159682a8e0665cfa813eb2d176724727cc49af /include/io/channel-websock.h | |
parent | a7b20a8efa28e5f22c26c06cd06c2f12bc863493 (diff) | |
download | qemu-57b0cdf152b7266e68bfa3e84635d4bdb64ef2cd.zip qemu-57b0cdf152b7266e68bfa3e84635d4bdb64ef2cd.tar.gz qemu-57b0cdf152b7266e68bfa3e84635d4bdb64ef2cd.tar.bz2 |
io: simplify websocket ping reply handling
We must ensure we don't get flooded with ping replies if the outbound
channel is slow. Currently we do this by keeping the ping reply in a
separate temporary buffer and only writing it if the encoutput buffer
is completely empty. This is overly pessimistic, as it is reasonable
to add a ping reply to the encoutput buffer even if it has previous
data in it, as long as that previous data doesn't include a ping
reply.
To track this better, put the ping reply directly into the encoutput
buffer, and then record the size of encoutput at this time in
pong_remain. As we write encoutput to the underlying channel, we
can decrement the pong_remain counter. Once it hits zero, we can
accept further ping replies for transmission.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'include/io/channel-websock.h')
-rw-r--r-- | include/io/channel-websock.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/io/channel-websock.h b/include/io/channel-websock.h index ff32d86..3762707 100644 --- a/include/io/channel-websock.h +++ b/include/io/channel-websock.h @@ -60,8 +60,8 @@ struct QIOChannelWebsock { Buffer encoutput; Buffer rawinput; Buffer rawoutput; - Buffer ping_reply; size_t payload_remain; + size_t pong_remain; QIOChannelWebsockMask mask; guint io_tag; Error *io_err; |