summaryrefslogtreecommitdiff
path: root/vdagent-virtio-port.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-10-28 10:55:22 +0200
committerHans de Goede <hdegoede@redhat.com>2010-10-28 10:55:22 +0200
commitd0c37c819d42000edc9bc56633d78416fd3ba1c8 (patch)
treef5f9326289b571fa8f17b4c974e00d55c92ab803 /vdagent-virtio-port.c
parentc259271317f9ee37336842616c3c3010a512da9a (diff)
vdagentd: flush vdagent channel writes before close
This makes sure our clipboard release message gets to the other side. This also avoids the client only getting half of a vdagent message with large messages.
Diffstat (limited to 'vdagent-virtio-port.c')
-rw-r--r--vdagent-virtio-port.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/vdagent-virtio-port.c b/vdagent-virtio-port.c
index e300da8..5a9512a 100644
--- a/vdagent-virtio-port.c
+++ b/vdagent-virtio-port.c
@@ -189,6 +189,14 @@ int vdagent_virtio_port_write(
return 0;
}
+void vdagent_virtio_port_flush(struct vdagent_virtio_port **portp)
+{
+ struct vdagent_virtio_port *port = *portp;
+
+ while (*portp && (*portp)->write_buf)
+ vdagent_virtio_port_do_write(portp);
+}
+
static void vdagent_virtio_port_do_chunk(struct vdagent_virtio_port **portp)
{
int avail, read, pos = 0;