[Spice-devel] [PATCH spice 2/3] char_device: Don't set the write-retry timer when not running

Hans de Goede hdegoede at redhat.com
Fri Mar 29 02:11:10 PDT 2013


The write-retry timer should not be set when we're leaving
spice_char_device_write_to_device because the char-dev has been stopped.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 server/char_device.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/server/char_device.c b/server/char_device.c
index 368c9bc..63afee1 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -468,10 +468,13 @@ static int spice_char_device_write_to_device(SpiceCharDeviceState *dev)
         dev->cur_write_buf_pos += n;
     }
     /* retry writing as long as the write queue is not empty */
-    if (dev->cur_write_buf) {
-        core->timer_start(dev->write_to_dev_timer, CHAR_DEVICE_WRITE_TO_TIMEOUT);
-    } else {
-        spice_assert(ring_is_empty(&dev->write_queue));
+    if (dev->running) {
+        if (dev->cur_write_buf) {
+            core->timer_start(dev->write_to_dev_timer,
+                              CHAR_DEVICE_WRITE_TO_TIMEOUT);
+        } else {
+            spice_assert(ring_is_empty(&dev->write_queue));
+        }
     }
     spice_char_device_state_unref(dev);
     dev->active = dev->active || total;
-- 
1.8.1.4



More information about the Spice-devel mailing list