Commit 4212b49a authored by Olivier Crête's avatar Olivier Crête

conncheck: Fetch stream once instead of twice

parent dcf3d71e
...@@ -1742,19 +1742,24 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -1742,19 +1742,24 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
guint32 priority; guint32 priority;
uint8_t uname[NICE_STREAM_MAX_UNAME]; uint8_t uname[NICE_STREAM_MAX_UNAME];
gsize uname_len = Stream *stream;
priv_create_username (agent, agent_find_stream (agent, pair->stream_id), gsize uname_len;
pair->component_id, pair->remote, pair->local, uname, sizeof (uname), FALSE);
uint8_t *password = NULL; uint8_t *password = NULL;
gsize password_len = priv_get_password (agent, gsize password_len;
agent_find_stream (agent, pair->stream_id), pair->remote, &password);
bool controlling = agent->controlling_mode; bool controlling = agent->controlling_mode;
/* XXX: add API to support different nomination modes: */ /* XXX: add API to support different nomination modes: */
bool cand_use = controlling; bool cand_use = controlling;
size_t buffer_len; size_t buffer_len;
unsigned int timeout; unsigned int timeout;
if (!agent_find_component (agent, pair->stream_id, pair->component_id,
&stream, NULL))
return -1;
uname_len = priv_create_username (agent, stream, pair->component_id,
pair->remote, pair->local, uname, sizeof (uname), FALSE);
password_len = priv_get_password (agent, stream, pair->remote, &password);
priority = peer_reflexive_candidate_priority (agent, pair->local); priority = peer_reflexive_candidate_priority (agent, pair->local);
if (password != NULL && if (password != NULL &&
...@@ -1814,18 +1819,18 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -1814,18 +1819,18 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
* check pair, until we discover a new local peer reflexive */ * check pair, until we discover a new local peer reflexive */
if (pair->sockptr->fileno == NULL && if (pair->sockptr->fileno == NULL &&
pair->local->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE) { pair->local->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE) {
Stream *stream = NULL; Stream *stream2 = NULL;
Component *component = NULL; Component *component2 = NULL;
NiceSocket *new_socket; NiceSocket *new_socket;
if (agent_find_component (agent, pair->stream_id, pair->component_id, if (agent_find_component (agent, pair->stream_id, pair->component_id,
&stream, &component)) { &stream2, &component2)) {
new_socket = nice_tcp_active_socket_connect (pair->sockptr, new_socket = nice_tcp_active_socket_connect (pair->sockptr,
&pair->remote->addr); &pair->remote->addr);
if (new_socket) { if (new_socket) {
pair->sockptr = new_socket; pair->sockptr = new_socket;
_priv_set_socket_tos (agent, pair->sockptr, stream->tos); _priv_set_socket_tos (agent, pair->sockptr, stream2->tos);
component_attach_socket (component, new_socket); component_attach_socket (component2, new_socket);
} }
} }
} }
......
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