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