summaryrefslogtreecommitdiffstats
path: root/server/reds.c
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2012-08-08 12:14:23 +0300
committerYonit Halperin <yhalperi@redhat.com>2012-08-27 09:04:51 +0300
commit56c9548f6471878a16cad90cc028defdae2cc7c4 (patch)
tree0fffdeee51707b0e66ffeec8a1503d8774943e8f /server/reds.c
parent49a8d68303f3d8681a9c61d74e0675279649d480 (diff)
downloadspice-56c9548f6471878a16cad90cc028defdae2cc7c4.tar.gz
spice-56c9548f6471878a16cad90cc028defdae2cc7c4.tar.xz
spice-56c9548f6471878a16cad90cc028defdae2cc7c4.zip
agent: reset client tokens when notifying on agent connection
send SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS
Diffstat (limited to 'server/reds.c')
-rw-r--r--server/reds.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/server/reds.c b/server/reds.c
index e3ea154a..8d6dbfb7 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -605,15 +605,19 @@ static void reds_reset_vdp(void)
* The client tokens' are set only once, when the main channel is initialized.
* Instead, it would have been more appropriate to reset them upon AGEN_CONNECT.
* The client tokens are tracked as part of the SpiceCharDeviceClientState. Thus,
- * in order to be backwartd compatible with the client, we need to track the tokens
- * event when the agent is detached. We don't destroy the the char_device state, and
+ * in order to be backward compatible with the client, we need to track the tokens
+ * even if the agent is detached. We don't destroy the the char_device state, and
* instead we just reset it.
- * In addition, there is a misshandling of AGENT_TOKENS message in spice-gtk: it
+ * In addition, there used to be a misshandling of AGENT_TOKENS message in spice-gtk: it
* overrides the amount of tokens, instead of adding the given amount.
- *
- * TODO: change AGENT_CONNECT msg to contain tokens count.
*/
- spice_char_device_reset(state->base);
+ if (red_channel_test_remote_cap(&reds->main_channel->base,
+ SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS)) {
+ spice_char_device_state_destroy(state->base);
+ state->base = NULL;
+ } else {
+ spice_char_device_reset(state->base);
+ }
sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceCharDeviceInterface, base);
if (sif->state) {