Commit 8ce18832 authored by Dafydd Harries's avatar Dafydd Harries

test server: accept remote candidates and add them to agent

darcs-hash:20070202075521-c9803-da196de467ed2345df655a3f1fd745e3fa5902f7.gz
parent f40b5f1d
...@@ -53,16 +53,30 @@ make_agent ( ...@@ -53,16 +53,30 @@ make_agent (
} }
static gboolean static gboolean
handle_tcp_read (guint fileno) handle_tcp_read (guint fileno, NiceAgent *agent)
{ {
//Candidate *candidate; NiceCandidate *candidate;
gchar *line; gchar *line;
line = readline (fileno); line = readline (fileno);
if (line == NULL) if (line == NULL)
/* EOF */
return FALSE; return FALSE;
candidate = nice_candidate_from_string (line);
if (candidate == NULL)
/* invalid candidate string */
return FALSE;
g_debug ("got remote candidate: %s", line);
nice_agent_add_remote_candidate (agent, 1, 1, candidate->type,
&candidate->addr, candidate->port, candidate->username,
candidate->password);
nice_candidate_free (candidate);
g_free (line);
return TRUE; return TRUE;
} }
...@@ -123,7 +137,7 @@ handle_connection (guint fileno, const struct sockaddr_in *sin, gpointer data) ...@@ -123,7 +137,7 @@ handle_connection (guint fileno, const struct sockaddr_in *sin, gpointer data)
g_debug ("got TCP data"); g_debug ("got TCP data");
if (!handle_tcp_read (fileno)) if (!handle_tcp_read (fileno, agent))
goto END; goto END;
} }
else if (i == sock->fileno) else if (i == sock->fileno)
......
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