mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-31 02:41:52 +00:00
agent: Sync AgentMsgFilter state upon agent connection
AgentMsgFilter needs to know whether monitors config messages need to be
filtered or not. This used to be done from within
agent_msg_filter_config() using the global RedsState, but this got more
tricky as it was removed.
A first attempt a1e62fa5ae caused crashes on qemu startup with
"qemu-system-x86_64 -spice port=5900" (without -vga qxl). A second
attempt added a RedsState* argument to agent_msg_filter_config() which
in my opinion is not really nice from a layering point of view.
This new attempt makes sure AgentMsgFilter state is correct when the
filter is set to stop discarding all data, which allows to remove direct
use of RedsState from within AgentMsgFilter.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
79e02e98ab
commit
0df59fcfc9
@ -27,15 +27,23 @@
|
||||
#include "reds.h"
|
||||
#include "red-qxl.h"
|
||||
|
||||
void agent_msg_filter_config(struct AgentMsgFilter *filter,
|
||||
gboolean copy_paste, gboolean file_xfer,
|
||||
gboolean use_client_monitors_config)
|
||||
{
|
||||
filter->copy_paste_enabled = copy_paste;
|
||||
filter->file_xfer_enabled = file_xfer;
|
||||
filter->use_client_monitors_config = use_client_monitors_config;
|
||||
}
|
||||
|
||||
void agent_msg_filter_init(struct AgentMsgFilter *filter,
|
||||
gboolean copy_paste, gboolean file_xfer,
|
||||
gboolean use_client_monitors_config,
|
||||
int discard_all)
|
||||
{
|
||||
memset(filter, 0, sizeof(*filter));
|
||||
filter->copy_paste_enabled = copy_paste;
|
||||
filter->file_xfer_enabled = file_xfer;
|
||||
filter->use_client_monitors_config = use_client_monitors_config;
|
||||
agent_msg_filter_config(filter, copy_paste, file_xfer,
|
||||
use_client_monitors_config);
|
||||
filter->discard_all = discard_all;
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,9 @@ void agent_msg_filter_init(struct AgentMsgFilter *filter,
|
||||
gboolean copy_paste, gboolean file_xfer,
|
||||
gboolean use_client_monitors_config,
|
||||
gboolean discard_all);
|
||||
void agent_msg_filter_config(struct AgentMsgFilter *filter,
|
||||
gboolean copy_paste, gboolean file_xfer,
|
||||
gboolean use_client_monitors_config);
|
||||
int agent_msg_filter_process_data(struct AgentMsgFilter *filter,
|
||||
uint8_t *data, uint32_t len);
|
||||
|
||||
|
||||
@ -953,6 +953,10 @@ void reds_on_main_agent_start(RedsState *reds, MainChannelClient *mcc, uint32_t
|
||||
rcc->client,
|
||||
num_tokens);
|
||||
}
|
||||
|
||||
agent_msg_filter_config(&reds->agent_state.write_filter, reds->agent_copypaste,
|
||||
reds->agent_file_xfer,
|
||||
reds_use_client_monitors_config(reds));
|
||||
reds->agent_state.write_filter.discard_all = FALSE;
|
||||
}
|
||||
|
||||
@ -1680,6 +1684,10 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
|
||||
if (mig_target) {
|
||||
spice_warning("unexpected: vdagent attached to destination during migration");
|
||||
}
|
||||
agent_msg_filter_config(&reds->agent_state.read_filter,
|
||||
reds->agent_copypaste,
|
||||
reds->agent_file_xfer,
|
||||
reds_use_client_monitors_config(reds));
|
||||
reds->agent_state.read_filter.discard_all = FALSE;
|
||||
reds->agent_state.plug_generation++;
|
||||
}
|
||||
@ -3190,8 +3198,6 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
|
||||
qxl = SPICE_CONTAINEROF(sin, QXLInstance, base);
|
||||
red_qxl_init(reds, qxl);
|
||||
reds->qxl_instances = g_list_prepend(reds->qxl_instances, qxl);
|
||||
reds->agent_state.write_filter.use_client_monitors_config = reds_use_client_monitors_config(reds);
|
||||
reds->agent_state.read_filter.use_client_monitors_config = reds_use_client_monitors_config(reds);
|
||||
|
||||
/* this function has to be called after the qxl is on the list
|
||||
* as QXLInstance clients expect the qxl to be on the list when
|
||||
|
||||
Loading…
Reference in New Issue
Block a user