Revision f76e4c7f
b/spice-qemu-char.c | ||
---|---|---|
69 | 69 |
return bytes; |
70 | 70 |
} |
71 | 71 |
|
72 |
static void vmc_state(SpiceCharDeviceInstance *sin, int connected) |
|
73 |
{ |
|
74 |
SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin); |
|
75 |
|
|
76 |
#if SPICE_SERVER_VERSION < 0x000901 |
|
77 |
/* |
|
78 |
* spice-server calls the state callback for the agent channel when the |
|
79 |
* spice client connects / disconnects. Given that not the client but |
|
80 |
* the server is doing the parsing of the messages this is wrong as the |
|
81 |
* server is still listening. Worse, this causes the parser in the server |
|
82 |
* to go out of sync, so we ignore state calls for subtype vdagent |
|
83 |
* spicevmc chardevs. For the full story see: |
|
84 |
* http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html |
|
85 |
*/ |
|
86 |
if (strcmp(sin->subtype, "vdagent") == 0) { |
|
87 |
return; |
|
88 |
} |
|
89 |
#endif |
|
90 |
|
|
91 |
if ((scd->chr->opened && connected) || |
|
92 |
(!scd->chr->opened && !connected)) { |
|
93 |
return; |
|
94 |
} |
|
95 |
|
|
96 |
qemu_chr_be_event(scd->chr, |
|
97 |
connected ? CHR_EVENT_OPENED : CHR_EVENT_CLOSED); |
|
98 |
} |
|
99 |
|
|
72 | 100 |
static SpiceCharDeviceInterface vmc_interface = { |
73 | 101 |
.base.type = SPICE_INTERFACE_CHAR_DEVICE, |
74 | 102 |
.base.description = "spice virtual channel char device", |
75 | 103 |
.base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR, |
76 | 104 |
.base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR, |
105 |
.state = vmc_state, |
|
77 | 106 |
.write = vmc_write, |
78 | 107 |
.read = vmc_read, |
79 | 108 |
}; |
... | ... | |
197 | 226 |
chr->chr_guest_open = spice_chr_guest_open; |
198 | 227 |
chr->chr_guest_close = spice_chr_guest_close; |
199 | 228 |
|
200 |
qemu_chr_generic_open(chr); |
|
229 |
#if SPICE_SERVER_VERSION < 0x000901 |
|
230 |
/* See comment in vmc_state() */ |
|
231 |
if (strcmp(subtype, "vdagent") == 0) { |
|
232 |
qemu_chr_generic_open(chr); |
|
233 |
} |
|
234 |
#endif |
|
201 | 235 |
|
202 | 236 |
*_chr = chr; |
203 | 237 |
return 0; |
Also available in: Unified diff