Commit aa301c19 authored by Dafydd Harries's avatar Dafydd Harries

refactor nice_agent_recv

darcs-hash:20070201180813-c9803-6f9c7991e1f1e0f7a69b69dcb0b59c73f6b31f27.gz
parent dfb1d6de
......@@ -533,35 +533,15 @@ ERROR:
*/
}
/**
* nice_agent_recv:
* @agent: The agent to notify
* @candidate_id: The ID of the candidate that has data waiting on its socket
*
* Tell the agent to try receiving a packet on @candidate's socket. This is
* useful for integrating the agent into a select()-loop. This function will
* block if the socket is blocking.
**/
void
nice_agent_recv (
static void
_nice_agent_recv (
NiceAgent *agent,
guint candidate_id)
NiceCandidate *candidate)
{
NiceCandidate *candidate;
guint len;
gchar buf[1024];
struct sockaddr_in from;
/* XXX: this is a probably a good place to start optimizing, as it gets
* called once for each packet recieved
*/
candidate = _local_candidate_lookup (agent, candidate_id);
if (candidate == NULL)
return;
len = udp_socket_recv (&(candidate->sock), &from,
sizeof (buf) / sizeof (gchar), buf);
g_assert (len > 0);
......@@ -627,6 +607,35 @@ nice_agent_recv (
}
/**
* nice_agent_recv:
* @agent: The agent to notify
* @candidate_id: The ID of the candidate that has data waiting on its socket
*
* Tell the agent to try receiving a packet on @candidate's socket. This is
* useful for integrating the agent into a select()-loop. This function will
* block if the socket is blocking.
**/
void
nice_agent_recv (
NiceAgent *agent,
guint candidate_id)
{
NiceCandidate *candidate;
/* XXX: this is a probably a good place to start optimizing, as it gets
* called once for each packet recieved
*/
candidate = _local_candidate_lookup (agent, candidate_id);
if (candidate == NULL)
return;
_nice_agent_recv (agent, candidate);
}
/**
* Set the STUN server from which to obtain server-reflexive candidates.
*/
......
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