Commit b2189b84 authored by Olivier Crête's avatar Olivier Crête

agent: Prevent gather from being called multiple times

This can cause odd behaviors as it is not a idempotent function.
parent b66a1aed
...@@ -2123,6 +2123,12 @@ nice_agent_gather_candidates ( ...@@ -2123,6 +2123,12 @@ nice_agent_gather_candidates (
return FALSE; return FALSE;
} }
if (stream->gathering_started) {
/* Stream is already gathering, ignore this call */
agent_unlock_and_emit (agent);
return TRUE;
}
nice_debug ("Agent %p : In %s mode, starting candidate gathering.", agent, nice_debug ("Agent %p : In %s mode, starting candidate gathering.", agent,
agent->full_mode ? "ICE-FULL" : "ICE-LITE"); agent->full_mode ? "ICE-FULL" : "ICE-LITE");
...@@ -2276,7 +2282,7 @@ nice_agent_gather_candidates ( ...@@ -2276,7 +2282,7 @@ nice_agent_gather_candidates (
} }
stream->gathering = TRUE; stream->gathering = TRUE;
stream->gathering_started = TRUE;
/* Only signal the new candidates after we're sure that the gathering was /* Only signal the new candidates after we're sure that the gathering was
* succesfful. But before sending gathering-done */ * succesfful. But before sending gathering-done */
......
...@@ -72,6 +72,7 @@ struct _Stream ...@@ -72,6 +72,7 @@ struct _Stream
gchar remote_ufrag[NICE_STREAM_MAX_UFRAG]; gchar remote_ufrag[NICE_STREAM_MAX_UFRAG];
gchar remote_password[NICE_STREAM_MAX_PWD]; gchar remote_password[NICE_STREAM_MAX_PWD];
gboolean gathering; gboolean gathering;
gboolean gathering_started;
gint tos; gint tos;
}; };
......
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