|
|
7bbc9c |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
7bbc9c |
From: Frediano Ziglio <fziglio@redhat.com>
|
|
|
7bbc9c |
Date: Tue, 24 Jan 2017 11:36:27 +0000
|
|
|
7bbc9c |
Subject: [spice-server] char-device: Do not stop and clear interface on reset
|
|
|
7bbc9c |
|
|
|
7bbc9c |
Currently, red_char_device_reset() stops the device, clears all pending
|
|
|
7bbc9c |
messages, and clears its device instance. After this function is called,
|
|
|
7bbc9c |
the char device will not work again until it is assigned a new device
|
|
|
7bbc9c |
instance and restarted. This is fine for the vdagent char device, which
|
|
|
7bbc9c |
is currently the only user of this function. But for the stream device,
|
|
|
7bbc9c |
we want to be able to reset the char device to a working state (e.g.
|
|
|
7bbc9c |
clear all pending messages, etc) without stopping or disabling the char
|
|
|
7bbc9c |
device. So this function will now only reset the char device to a clean
|
|
|
7bbc9c |
working state, and the _stop() and _reset_dev_instance() calls will be
|
|
|
7bbc9c |
moved up to the caller.
|
|
|
7bbc9c |
|
|
|
7bbc9c |
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
|
|
|
7bbc9c |
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
7bbc9c |
---
|
|
|
7bbc9c |
server/char-device.c | 2 --
|
|
|
7bbc9c |
server/reds.c | 6 +++++-
|
|
|
7bbc9c |
2 files changed, 5 insertions(+), 3 deletions(-)
|
|
|
7bbc9c |
|
|
|
7bbc9c |
diff --git a/server/char-device.c b/server/char-device.c
|
|
|
7bbc9c |
index 658f9f364..f8a098bd8 100644
|
|
|
7bbc9c |
--- a/server/char-device.c
|
|
|
7bbc9c |
+++ b/server/char-device.c
|
|
|
7bbc9c |
@@ -823,7 +823,6 @@ void red_char_device_reset(RedCharDevice *dev)
|
|
|
7bbc9c |
GList *client_item;
|
|
|
7bbc9c |
RedCharDeviceWriteBuffer *buf;
|
|
|
7bbc9c |
|
|
|
7bbc9c |
- red_char_device_stop(dev);
|
|
|
7bbc9c |
dev->priv->wait_for_migrate_data = FALSE;
|
|
|
7bbc9c |
spice_debug("char device %p", dev);
|
|
|
7bbc9c |
while ((buf = g_queue_pop_tail(&dev->priv->write_queue))) {
|
|
|
7bbc9c |
@@ -845,7 +844,6 @@ void red_char_device_reset(RedCharDevice *dev)
|
|
|
7bbc9c |
dev_client->num_client_tokens += dev_client->num_client_tokens_free;
|
|
|
7bbc9c |
dev_client->num_client_tokens_free = 0;
|
|
|
7bbc9c |
}
|
|
|
7bbc9c |
- red_char_device_reset_dev_instance(dev, NULL);
|
|
|
7bbc9c |
}
|
|
|
7bbc9c |
|
|
|
7bbc9c |
void red_char_device_wakeup(RedCharDevice *dev)
|
|
|
7bbc9c |
diff --git a/server/reds.c b/server/reds.c
|
|
|
7bbc9c |
index b24f61ab2..401d242fb 100644
|
|
|
7bbc9c |
--- a/server/reds.c
|
|
|
7bbc9c |
+++ b/server/reds.c
|
|
|
7bbc9c |
@@ -470,6 +470,7 @@ static void reds_reset_vdp(RedsState *reds)
|
|
|
7bbc9c |
{
|
|
|
7bbc9c |
RedCharDeviceVDIPort *dev = reds->agent_dev;
|
|
|
7bbc9c |
SpiceCharDeviceInterface *sif;
|
|
|
7bbc9c |
+ RedCharDevice *char_dev;
|
|
|
7bbc9c |
|
|
|
7bbc9c |
dev->priv->read_state = VDI_PORT_READ_STATE_READ_HEADER;
|
|
|
7bbc9c |
dev->priv->receive_pos = (uint8_t *)&dev->priv->vdi_chunk_header;
|
|
|
7bbc9c |
@@ -502,7 +503,10 @@ static void reds_reset_vdp(RedsState *reds)
|
|
|
7bbc9c |
* The tokens are also reset to avoid mismatch in upon agent reconnection.
|
|
|
7bbc9c |
*/
|
|
|
7bbc9c |
dev->priv->agent_attached = FALSE;
|
|
|
7bbc9c |
- red_char_device_reset(RED_CHAR_DEVICE(dev));
|
|
|
7bbc9c |
+ char_dev = RED_CHAR_DEVICE(dev);
|
|
|
7bbc9c |
+ red_char_device_stop(char_dev);
|
|
|
7bbc9c |
+ red_char_device_reset(char_dev);
|
|
|
7bbc9c |
+ red_char_device_reset_dev_instance(char_dev, NULL);
|
|
|
7bbc9c |
|
|
|
7bbc9c |
sif = spice_char_device_get_interface(reds->vdagent);
|
|
|
7bbc9c |
if (sif->state) {
|