Commit bc527dcf authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

agent: Simplify control flow in agent_recv_locked()

This introduces no functional changes.
parent 10cfd76d
...@@ -2466,14 +2466,19 @@ agent_recv_locked ( ...@@ -2466,14 +2466,19 @@ agent_recv_locked (
for (item = component->turn_servers; item; item = g_list_next (item)) { for (item = component->turn_servers; item; item = g_list_next (item)) {
TurnServer *turn = item->data; TurnServer *turn = item->data;
if (nice_address_equal (&from, &turn->server)) { GSList *i = NULL;
GSList * i = NULL;
if (!nice_address_equal (&from, &turn->server))
continue;
#ifndef NDEBUG #ifndef NDEBUG
nice_debug ("Agent %p : Packet received from TURN server candidate.", nice_debug ("Agent %p : Packet received from TURN server candidate.",
agent); agent);
#endif #endif
for (i = component->local_candidates; i; i = i->next) { for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *cand = i->data; NiceCandidate *cand = i->data;
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED && if (cand->type == NICE_CANDIDATE_TYPE_RELAYED &&
cand->stream_id == stream->id && cand->stream_id == stream->id &&
cand->component_id == component->id) { cand->component_id == component->id) {
...@@ -2481,25 +2486,21 @@ agent_recv_locked ( ...@@ -2481,25 +2486,21 @@ agent_recv_locked (
&from, len, (gchar *) local_buf, &from, (gchar *) local_buf, len); &from, len, (gchar *) local_buf, &from, (gchar *) local_buf, len);
} }
} }
break;
}
} }
agent->media_after_tick = TRUE; agent->media_after_tick = TRUE;
/* If the message’s stated length is equal to its actual length, it’s probably
* a STUN message; otherwise it’s probably data. */
if (stun_message_validate_buffer_length ((uint8_t *) local_buf, (size_t) len, if (stun_message_validate_buffer_length ((uint8_t *) local_buf, (size_t) len,
(agent->compatibility != NICE_COMPATIBILITY_OC2007 && (agent->compatibility != NICE_COMPATIBILITY_OC2007 &&
agent->compatibility != NICE_COMPATIBILITY_OC2007R2)) != len) agent->compatibility != NICE_COMPATIBILITY_OC2007R2)) == len &&
/* If the retval is not 0, it’s not a valid STUN packet; probably data. */ conn_check_handle_inbound_stun (agent, stream, component, socket,
goto handle_tcp; &from, (gchar *) local_buf, len)) {
/* Handled STUN message. */
if (conn_check_handle_inbound_stun (agent, stream, component, socket,
&from, (gchar *) local_buf, len))
/* handled STUN message*/
return 0; return 0;
}
handle_tcp:
/* Unhandled STUN; try handling TCP data, then pass to the client. */ /* Unhandled STUN; try handling TCP data, then pass to the client. */
if (len > 0 && component->tcp) { if (len > 0 && component->tcp) {
/* If we don’t yet have an underlying selected socket, queue up the incoming /* If we don’t yet have an underlying selected socket, queue up the incoming
......
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