Commit 816bf91a authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête
Browse files

agent: Assert on re-entrant reads

Ensure the agent’s context doesn’t get iterated while in the middle of
reading a message, as that will corrupt the component->recv_messages
state.
parent 5095efee
...@@ -3127,6 +3127,10 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent, ...@@ -3127,6 +3127,10 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
blocking ? "blocking" : "non-blocking"); blocking ? "blocking" : "non-blocking");
nice_debug_input_message_composition (messages, n_messages); nice_debug_input_message_composition (messages, n_messages);
/* Disallow re-entrant reads. */
g_assert (component->n_recv_messages == 0 &&
component->recv_messages == NULL);
/* Set the component’s receive buffer. */ /* Set the component’s receive buffer. */
context = component_dup_io_context (component); context = component_dup_io_context (component);
component_set_io_callback (component, NULL, NULL, messages, n_messages, component_set_io_callback (component, NULL, NULL, messages, n_messages,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment