spice-qemu-char: Generate chardev open/close events
commitf76e4c7f16c7ab966a792310b6630d3e240688b3
authorHans de Goede <hdegoede@redhat.com>
Sat, 19 Nov 2011 09:22:44 +0000 (19 10:22 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 28 Nov 2011 22:20:51 +0000 (28 16:20 -0600)
treec12b12b7625487469654e1e07e0c117108831d9b
parenta425d23f8fad482f7792745036896eb2f72330de
spice-qemu-char: Generate chardev open/close events

Define a state callback and make that generate chardev open/close events when
called by the spice-server.

Notes:

1) For all but the newest spice-server versions (which have a fix for this)
the code ignores these events for a spicevmc with a subtype of vdagent, this
subtype specific knowledge is undesirable, but unavoidable for now, see:
http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html

2) This code deliberately sends the events immediately rather then from a
bh. This is done this way because:
a) There is no need to do it from a bh; and
b) Doing it from a bh actually causes issues because the spice-server may send
data immediately after the open and when the open runs from a bh, then
qemu_chr_be_can_write will return 0 for the first write which the spice-server
does not expect, when this happens the spice-server will never retry the write
causing communication to stall.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
spice-qemu-char.c