if (agent->controlling_mode &&
agent->nomination_mode == NICE_NOMINATION_MODE_AGGRESSIVE &&
transport != NICE_CANDIDATE_TRANSPORT_UDP) {
- if (component->state < NICE_COMPONENT_STATE_CONNECTING) {
- nice_debug ("Agent %p : we have a TCP candidate, switching back "
- "to regular nomination mode", agent);
- agent->nomination_mode = NICE_NOMINATION_MODE_REGULAR;
- } else {
+ if (conn_check_stun_transactions_count (agent) > 0) {
/* changing nomination mode from aggressive to regular while
* conncheck is ongoing may cause unexpected results (inflight
* aggressive stun requests may nominate a pair unilaterally)
nice_debug ("Agent %p : we have a TCP candidate, but conncheck "
"has started already in aggressive mode, ignore it", agent);
goto errors;
+ } else {
+ nice_debug ("Agent %p : we have a TCP candidate, switching back "
+ "to regular nomination mode", agent);
+ agent->nomination_mode = NICE_NOMINATION_MODE_REGULAR;
}
}
}
}
}
+guint
+conn_check_stun_transactions_count (NiceAgent *agent)
+{
+ GSList *i, *j;
+ guint count = 0;
+
+ for (i = agent->streams; i ; i = i->next) {
+ NiceStream *s = i->data;
+ for (j = s->conncheck_list; j ; j = j->next) {
+ CandidateCheckPair *p = j->data;
+
+ if (p->stun_transactions)
+ count += g_slist_length (p->stun_transactions);
+ }
+ }
+ return count;
+}
+
/*
* Create a new STUN transaction and add it to the list
* of ongoing stun transactions of a pair.
void conn_check_update_check_list_state_for_ready (NiceAgent *agent,
NiceStream *stream, NiceComponent *component);
void conn_check_unfreeze_related (NiceAgent *agent, CandidateCheckPair *pair);
+guint conn_check_stun_transactions_count (NiceAgent *agent);
#endif /*_NICE_CONNCHECK_H */