[Spice-devel] [PATCH spice 1/3] char_device: Properly update buffer status when leaving the write loop on stop
Hans de Goede
hdegoede at redhat.com
Fri Mar 29 02:11:09 PDT 2013
Before this patch the write-loop in spice_char_device_write_to_device would
break on running becoming 0, after having written some data, without updating
the buffer status, causing the same data to be written *again* when started.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
server/char_device.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/server/char_device.c b/server/char_device.c
index e07eda1..368c9bc 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -438,7 +438,7 @@ static int spice_char_device_write_to_device(SpiceCharDeviceState *dev)
core->timer_cancel(dev->write_to_dev_timer);
sif = SPICE_CONTAINEROF(dev->sin->base.sif, SpiceCharDeviceInterface, base);
- while (1) {
+ while (dev->running) {
uint32_t write_len;
if (!dev->cur_write_buf) {
@@ -454,9 +454,6 @@ static int spice_char_device_write_to_device(SpiceCharDeviceState *dev)
write_len = dev->cur_write_buf->buf + dev->cur_write_buf->buf_used -
dev->cur_write_buf_pos;
n = sif->write(dev->sin, dev->cur_write_buf_pos, write_len);
- if (!dev->running) {
- break;
- }
if (n <= 0) {
break;
}
--
1.8.1.4
More information about the Spice-devel
mailing list