[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/20] vnc-jobs: move buffer reset, use new buffer mo
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 09/20] vnc-jobs: move buffer reset, use new buffer move |
Date: |
Mon, 16 Nov 2015 18:25:24 +0100 |
Signed-off-by: Gerd Hoffmann <address@hidden>
Reviewed-by: Peter Lieven <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
---
ui/vnc-jobs.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index 329d13e..fd9ed39 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -29,6 +29,7 @@
#include "vnc.h"
#include "vnc-jobs.h"
#include "qemu/sockets.h"
+#include "qemu/main-loop.h"
#include "block/aio.h"
/*
@@ -165,8 +166,11 @@ void vnc_jobs_consume_buffer(VncState *vs)
vnc_lock_output(vs);
if (vs->jobs_buffer.offset) {
- vnc_write(vs, vs->jobs_buffer.buffer, vs->jobs_buffer.offset);
- buffer_reset(&vs->jobs_buffer);
+ if (vs->csock != -1 && buffer_empty(&vs->output)) {
+ qemu_set_fd_handler(vs->csock, vnc_client_read,
+ vnc_client_write, vs);
+ }
+ buffer_move(&vs->output, &vs->jobs_buffer);
}
flush = vs->csock != -1 && vs->abort != true;
vnc_unlock_output(vs);
@@ -193,8 +197,6 @@ static void vnc_async_encoding_start(VncState *orig,
VncState *local)
local->hextile = orig->hextile;
local->zrle = orig->zrle;
local->csock = -1; /* Don't do any network work on this thread */
-
- buffer_reset(&local->output);
}
static void vnc_async_encoding_end(VncState *orig, VncState *local)
@@ -272,14 +274,13 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)
vnc_lock_output(job->vs);
if (job->vs->csock != -1) {
- buffer_reserve(&job->vs->jobs_buffer, vs.output.offset);
- buffer_append(&job->vs->jobs_buffer, vs.output.buffer,
- vs.output.offset);
+ buffer_move(&job->vs->jobs_buffer, &vs.output);
/* Copy persistent encoding data */
vnc_async_encoding_end(job->vs, &vs);
qemu_bh_schedule(job->vs->bh);
} else {
+ buffer_reset(&vs.output);
/* Copy persistent encoding data */
vnc_async_encoding_end(job->vs, &vs);
}
--
1.8.3.1
- [Qemu-devel] [PULL for-2.5 00/20] vnc: buffer code improvements, bugfixes., Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 13/20] vnc: use vnc_{width, height} in vnc_set_area_dirty, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 01/20] buffer: make the Buffer capacity increase in powers of two, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 09/20] vnc-jobs: move buffer reset, use new buffer move,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 04/20] buffer: add buffer_move, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 10/20] vnc: zap dead code, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 06/20] buffer: add tracing, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 08/20] vnc: kill jobs queue buffer, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 02/20] buffer: add buffer_init, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 18/20] buffer: factor out buffer_adj_size, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 16/20] vnc: recycle empty vs->output buffer, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 19/20] buffer: allow a buffer to shrink gracefully, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 11/20] vnc: add vnc_width+vnc_height helpers, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 03/20] buffer: add buffer_move_empty, Gerd Hoffmann, 2015/11/16