summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/main_channel.c17
-rw-r--r--server/reds.c16
m---------spice-common0
3 files changed, 26 insertions, 7 deletions
diff --git a/server/main_channel.c b/server/main_channel.c
index 00a6b0f4..0d948dec 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -388,7 +388,19 @@ static void main_channel_marshall_mouse_mode(SpiceMarshaller *m, int current_mod
void main_channel_push_agent_connected(MainChannel *main_chan)
{
- red_channel_pipes_add_type(&main_chan->base, SPICE_MSG_MAIN_AGENT_CONNECTED);
+ if (red_channel_test_remote_cap(&main_chan->base, SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS)) {
+ red_channel_pipes_add_type(&main_chan->base, SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS);
+ } else {
+ red_channel_pipes_add_type(&main_chan->base, SPICE_MSG_MAIN_AGENT_CONNECTED);
+ }
+}
+
+static void main_channel_marshall_agent_connected(SpiceMarshaller *m)
+{
+ SpiceMsgMainAgentConnectedTokens connected;
+
+ connected.num_tokens = REDS_AGENT_WINDOW_SIZE;
+ spice_marshall_msg_main_agent_connected_tokens(m, &connected);
}
void main_channel_push_agent_disconnected(MainChannel *main_chan)
@@ -729,6 +741,9 @@ static void main_channel_send_item(RedChannelClient *rcc, PipeItem *base)
case SPICE_MSG_MAIN_UUID:
spice_marshall_msg_main_uuid(m, &SPICE_CONTAINEROF(base, UuidPipeItem, base)->msg);
break;
+ case SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS:
+ main_channel_marshall_agent_connected(m);
+ break;
default:
break;
};
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) {
diff --git a/spice-common b/spice-common
-Subproject c0b048ebef41b3a79d42e96c0ecaef65e1bb759
+Subproject c6bd210ad0b6eb485fda25426ab9d75253439f5