Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 ui/vnc-jobs.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index 50e6b37..dfc5139 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -165,8 +165,7 @@ 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);
-        qio_buffer_reset(&vs->jobs_buffer);
+        qio_buffer_move(&vs->output, &vs->jobs_buffer);
     }
     flush = vs->csock != -1 && vs->abort != true;
     vnc_unlock_output(vs);
@@ -193,8 +192,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 */
-
-    qio_buffer_reset(&local->output);
 }
 
 static void vnc_async_encoding_end(VncState *orig, VncState *local)
@@ -271,14 +268,13 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)
     vnc_lock_output(job->vs);
 
     if (job->vs->csock != -1) {
-        qio_buffer_reserve(&job->vs->jobs_buffer, vs.output.offset);
-        qio_buffer_append(&job->vs->jobs_buffer, vs.output.buffer,
-                          vs.output.offset);
+        qio_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 {
+        qio_buffer_reset(&vs.output);
         /* Copy persistent encoding data */
         vnc_async_encoding_end(job->vs, &vs);
     }
-- 
1.8.3.1


Reply via email to