mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-22 20:41:22 +00:00
agent: reset client tokens when notifying on agent connection
send SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS
This commit is contained in:
parent
49a8d68303
commit
56c9548f64
@ -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;
|
||||
};
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit c0b048ebef41b3a79d42e96c0ecaef65e1bb7599
|
||||
Subproject commit c6bd210ad0b6eb485fda25426ab9d75253439f54
|
||||
Loading…
Reference in New Issue
Block a user