Commit cbcff613 authored by Kai Vehmanen's avatar Kai Vehmanen

Added support for forcing selection of a candidate pair. This allows to...

Added support for forcing selection of a candidate pair. This allows to interoperate with clients that do not support ICE. Added a unit test for fallback functionality. Some 64bit compilation fixes included.

darcs-hash:20070830070718-77cd4-02e9764b213673506df7d71ec768e42a29bb09dd.gz
parent bd46f868
......@@ -65,7 +65,8 @@ check_PROGRAMS = \
test-poll \
test-mainloop \
test-fullmode \
test-restart
test-restart \
test-fallback
check_SCRIPTS = \
check-test-fullmode-with-stun.sh
......
......@@ -126,6 +126,6 @@ void agent_signal_new_remote_candidate (NiceAgent *agent, NiceCandidate *candida
void agent_signal_initial_binding_request_received (NiceAgent *agent, Stream *stream);
void agent_free_discovery_candidate_udp (gpointer data, gpointer user_data);
guint64 agent_candidate_pair_priority (NiceAgent *agent, NiceCandidate *local, NiceCandidate *remote);
#endif /*_NICE_AGENT_PRIV_H */
......@@ -528,6 +528,15 @@ void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, gui
}
}
guint64
agent_candidate_pair_priority (NiceAgent *agent, NiceCandidate *local, NiceCandidate *remote)
{
if (agent->controlling_mode == TRUE)
return nice_candidate_pair_priority (local->priority, remote->priority);
return nice_candidate_pair_priority (remote->priority, local->priority);
}
static gboolean
priv_add_srv_rfx_candidate_discovery (NiceAgent *agent, NiceCandidate *host_candidate, const gchar *stun_server_ip, const guint stun_server_port, Stream *stream, guint component_id, NiceAddress *addr)
{
......@@ -998,7 +1007,8 @@ _nice_agent_recv (
if (len >= 0) {
gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&from, tmpbuf);
g_debug ("Packet received on local socket %u from %s:%u (%u octets).", udp_socket->fileno, tmpbuf, from.port, len);
g_debug ("Packet received on local socket %u from [%s]:%u (%u octets).",
udp_socket->fileno, tmpbuf, nice_address_get_port (&from), len);
}
#endif
......@@ -1596,3 +1606,41 @@ nice_agent_main_context_attach (
return TRUE;
}
/**
* Sets the selected candidate pair for media transmission
* for given stream component. Calling this function will
* disable all further ICE processing (connection check,
* state machine updates, etc). Note that keepalives will
* continue to be sent.
*/
NICEAPI_EXPORT gboolean
nice_agent_set_selected_pair (
NiceAgent *agent,
guint stream_id,
guint component_id,
const gchar *lfoundation,
const gchar *rfoundation)
{
Component *component;
CandidatePair pair;
/* step: check that params specify an existing pair */
if (!agent_find_component (agent, stream_id, component_id, NULL, &component))
return FALSE;
if (!component_find_pair (component, agent, lfoundation, rfoundation, &pair))
return FALSE;
/* step: stop connectivity checks (note: for the whole stream) */
conn_check_prune_stream (agent, stream_id);
/* step: change component state */
agent_signal_component_state_change (agent, stream_id, component_id, NICE_COMPONENT_STATE_READY);
/* step: set the selected pair */
component_update_selected_pair (component, &pair);
agent_signal_new_selected_pair (agent, stream_id, component_id, lfoundation, rfoundation);
return TRUE;
}
......@@ -224,6 +224,14 @@ nice_agent_main_context_attach (
NiceAgentRecvFunc func,
gpointer data);
gboolean
nice_agent_set_selected_pair (
NiceAgent *agent,
guint stream_id,
guint component_id,
const gchar *lfoundation,
const gchar *rfoundation);
G_END_DECLS
#endif /* _AGENT_H */
......
......@@ -45,7 +45,10 @@
# include <config.h>
#endif
#include <string.h>
#include "component.h"
#include "agent-priv.h"
Component *
component_new (
......@@ -126,6 +129,43 @@ component_find_udp_socket_by_fd (Component *component, guint fd)
return NULL;
}
/**
* Finds a candidate pair that has matching foundation ids.
*
* @return TRUE if pair found, pointer to pair stored at 'pair'
*/
gboolean
component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair)
{
GSList *i;
CandidatePair result = { NULL, NULL, 0 };
for (i = cmp->local_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data;
if (strncmp (candidate->foundation, lfoundation, NICE_CANDIDATE_MAX_FOUNDATION) == 0) {
result.local = candidate;
break;
}
}
for (i = cmp->remote_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data;
if (strncmp (candidate->foundation, rfoundation, NICE_CANDIDATE_MAX_FOUNDATION) == 0) {
result.remote = candidate;
break;
}
}
if (result.local && result.remote) {
result.priority = agent_candidate_pair_priority (agent, result.local, result.remote);
if (pair)
*pair = result;
return TRUE;
}
return FALSE;
}
/**
* Resets the component state to that of a ICE restarted
* session.
......@@ -156,3 +196,18 @@ component_restart (Component *cmp)
return TRUE;
}
/**
* Changes the selected pair for the component to 'pair'. Does not
* emit the "selected-pair-changed" signal.
*/
void component_update_selected_pair (Component *component, const CandidatePair *pair)
{
g_assert (component);
g_assert (pair);
g_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%lu).",
component->id, pair->local->foundation, pair->remote->foundation, (long unsigned)pair->priority);
component->selected_pair.local = pair->local;
component->selected_pair.remote = pair->remote;
component->selected_pair.priority = pair->priority;
}
......@@ -65,7 +65,7 @@ struct _CandidatePair
struct _Component
{
NiceComponentType type;
guint id;
guint id; /**< component id */
NiceComponentState state;
GSList *local_candidates; /**< list of Candidate objs */
GSList *remote_candidates; /**< list of Candidate objs */
......@@ -89,9 +89,15 @@ component_free (Component *cmp);
NiceUDPSocket *
component_find_udp_socket_by_fd (Component *component, guint fd);
gboolean
component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair);
gboolean
component_restart (Component *cmp);
void
component_update_selected_pair (Component *component, const CandidatePair *pair);
G_END_DECLS
#endif /* _NICE_COMPONENT_H */
......
......@@ -95,7 +95,7 @@ static gboolean priv_conn_check_initiate (NiceAgent *agent, CandidateCheckPair *
* see "7.2.1.4 Triggered Checks"
*/
g_get_current_time (&pair->next_tick);
g_time_val_add (&pair->next_tick, agent->timer_ta * 10);
g_time_val_add (&pair->next_tick, agent->timer_ta * 1000);
pair->state = NICE_CHECK_IN_PROGRESS;
conn_check_send (agent, pair);
return TRUE;
......@@ -118,7 +118,6 @@ static gboolean priv_conn_check_unfreeze_next (NiceAgent *agent, GSList *connche
GSList *i;
guint c;
guint max_components = 0;
gboolean frozen = FALSE;
/* step: calculate the max number of components across streams */
for (i = agent->streams; i; i = i->next) {
......@@ -142,7 +141,6 @@ static gboolean priv_conn_check_unfreeze_next (NiceAgent *agent, GSList *connche
CandidateCheckPair *p = i->data;
if (p->component_id == c + 1) {
if (p->state == NICE_CHECK_FROZEN) {
frozen = TRUE;
if (p->priority > max_frozen_priority) {
max_frozen_priority = p->priority;
pair = p;
......@@ -255,7 +253,6 @@ static gboolean priv_conn_check_tick (gpointer pointer)
CandidateCheckPair *p = i->data;
if (p->state == NICE_CHECK_IN_PROGRESS) {
/* note: macro from sys/time.h but compatible with GTimeVal */
if (p->stun_ctx == NULL) {
g_debug ("STUN connectivity check was cancelled, marking as done.");
p->state = NICE_CHECK_FAILED;
......@@ -267,8 +264,8 @@ static gboolean priv_conn_check_tick (gpointer pointer)
unsigned int timeout = stun_bind_timeout (p->stun_ctx);
/* note: convert from milli to microseconds for g_time_val_add() */
g_get_current_time (&p->next_tick);
g_time_val_add (&p->next_tick, timeout * 10);
p->next_tick = now;
g_time_val_add (&p->next_tick, timeout * 1000);
keep_timer_going = TRUE;
p->traffic_after_tick = TRUE; /* for keepalive timer */
......@@ -468,11 +465,8 @@ static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Comp
pair->local = local;
pair->remote = remote;
g_snprintf (pair->foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s", local->foundation, remote->foundation);
if (agent->controlling_mode == TRUE)
pair->priority = nice_candidate_pair_priority (local->priority, remote->priority);
else
pair->priority = nice_candidate_pair_priority (remote->priority, local->priority);
pair->priority = agent_candidate_pair_priority (agent, local, remote);
pair->state = initial_state;
pair->nominated = use_candidate;
pair->controlling = agent->controlling_mode;
......@@ -736,7 +730,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
timeout = stun_bind_timeout (pair->stun_ctx);
/* note: convert from milli to microseconds for g_time_val_add() */
g_get_current_time (&pair->next_tick);
g_time_val_add (&pair->next_tick, timeout * 10);
g_time_val_add (&pair->next_tick, timeout * 1000);
pair->traffic_after_tick = TRUE; /* for keepalive timer */
}
......@@ -891,6 +885,7 @@ static gboolean priv_update_selected_pair (NiceAgent *agent, Component *componen
static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceUDPSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate)
{
GSList *i;
gboolean result = FALSE;
for (i = agent->conncheck_list; i ; i = i->next) {
CandidateCheckPair *p = i->data;
......@@ -931,7 +926,6 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
}
{
gboolean result = FALSE;
NiceCandidate *local = NULL;
for (i = component->local_candidates; i ; i = i->next) {
......@@ -947,7 +941,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
g_debug ("Didn't find a matching pair for triggered check (remote-cand=%p).", remote_cand);
}
return FALSE;
return result;
}
/**
......@@ -993,7 +987,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Componen
tmpbuf,
nice_address_get_port (&cand->addr),
udp_socket->fileno,
rbuf_len,
(unsigned)rbuf_len,
cand, component->id,
(int)use_candidate);
}
......@@ -1030,9 +1024,9 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
pair->state = NICE_CHECK_DISCOVERED;
g_snprintf (pair->foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s", local_cand->foundation, parent_pair->remote->foundation);
if (agent->controlling_mode == TRUE)
pair->priority = nice_candidate_pair_priority (local_cand->priority, parent_pair->remote->priority);
pair->priority = nice_candidate_pair_priority (local_cand->priority, parent_pair->priority);
else
pair->priority = nice_candidate_pair_priority (parent_pair->remote->priority, local_cand->priority);
pair->priority = nice_candidate_pair_priority (parent_pair->priority, local_cand->priority);
pair->nominated = FALSE;
pair->controlling = agent->controlling_mode;
g_debug ("added a new peer-discovered pair with foundation of '%s'.", pair->foundation);
......@@ -1053,10 +1047,7 @@ static void priv_recalculate_pair_priorities (NiceAgent *agent)
for (i = agent->conncheck_list; i; i = i->next) {
CandidateCheckPair *p = i->data;
if (agent->controlling_mode == TRUE)
p->priority = nice_candidate_pair_priority (p->local->priority, p->remote->priority);
else
p->priority = nice_candidate_pair_priority (p->remote->priority, p->local->priority);
p->priority = agent_candidate_pair_priority (agent, p->local, p->remote);
}
}
......@@ -1098,7 +1089,7 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
CandidateCheckPair *p = i->data;
if (p->stun_ctx) {
res = stun_bind_process (p->stun_ctx, buf, len, &sockaddr, &socklen);
g_debug ("stun_bind_process/conncheck for %p res %d (%s) (controlling=%d).", p, res, strerror (res), agent->controlling_mode);
g_debug ("stun_bind_process/conncheck for %p res %d (%s) (controlling=%d).", p, (int)res, strerror (res), agent->controlling_mode);
if (res == 0) {
/* case: found a matching connectivity check request */
......@@ -1224,7 +1215,8 @@ static gboolean priv_map_reply_to_discovery_request (NiceAgent *agent, gchar *bu
CandidateDiscovery *d = i->data;
if (d->stun_ctx) {
res = stun_bind_process (d->stun_ctx, buf, len, &sockaddr, &socklen);
g_debug ("stun_bind_process/disc for %p res %d (%s).", d, res, strerror (res));
g_debug ("stun_bind_process/disc for %p res %d (%s).", d, (int)res,
strerror (res));
if (res == 0) {
/* case: succesful binding discovery, create a new local candidate */
NiceAddress niceaddr;
......
......@@ -172,28 +172,35 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi
* Implements the mechanism described in ICE sect
* 4.1.1.4 "Computing Foundations" (ID-17).
*/
static void priv_assign_foundation (NiceAgent *agent, Component *component, NiceCandidate *candidate)
static void priv_assign_foundation (NiceAgent *agent, NiceCandidate *candidate)
{
GSList *i;
for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *n = i->data;
NiceAddress temp = n->base_addr;
GSList *i, *j, *k;
for (i = agent->streams; i; i = i->next) {
Stream *stream = i->data;
for (j = stream->components; j; j = j->next) {
Component *component = j->data;
for (k = component->local_candidates; k; k = k->next) {
NiceCandidate *n = k->data;
NiceAddress temp = n->base_addr;
/* note: ports are not be compared */
temp.port = candidate->base_addr.port;
if (candidate->type == n->type &&
nice_address_equal (&candidate->base_addr, &n->base_addr)) {
/* note: currently only one STUN/TURN server per stream at a
* time is supported, so there is no need to check
* for candidates that would otherwise share the
* foundation, but have different STUN/TURN servers */
memcpy (candidate->foundation, n->foundation, NICE_CANDIDATE_MAX_FOUNDATION);
return;
/* note: ports are not be compared */
nice_address_set_port (&temp,
nice_address_get_port (&candidate->base_addr));
if (candidate->type == n->type &&
nice_address_equal (&candidate->base_addr, &temp)) {
/* note: currently only one STUN/TURN server per stream at a
* time is supported, so there is no need to check
* for candidates that would otherwise share the
* foundation, but have different STUN/TURN servers */
memcpy (candidate->foundation, n->foundation, NICE_CANDIDATE_MAX_FOUNDATION);
return;
}
}
}
}
g_snprintf (candidate->foundation, NICE_CANDIDATE_MAX_FOUNDATION, "%u", agent->next_candidate_id++);
}
......@@ -222,13 +229,14 @@ NiceCandidate *discovery_add_local_host_candidate (
if (candidate) {
NiceUDPSocket *udp_socket = g_slice_new0 (NiceUDPSocket);
if (udp_socket) {
priv_assign_foundation (agent, component, candidate);
candidate->stream_id = stream_id;
candidate->component_id = component_id;
candidate->addr = *address;
candidate->base_addr = *address;
candidate->priority = nice_candidate_ice_priority (candidate);
priv_assign_foundation (agent, candidate);
/* note: candidate username and password are left NULL as stream
level ufrag/password are used */
......@@ -299,7 +307,6 @@ discovery_add_server_reflexive_candidate (
candidate->priority =
nice_candidate_ice_priority_full
(NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE, 0, component_id);
priv_assign_foundation (agent, component, candidate);
candidate->stream_id = stream_id;
candidate->component_id = component_id;
candidate->addr = *address;
......@@ -308,6 +315,8 @@ discovery_add_server_reflexive_candidate (
candidate->sockptr = base_socket;
candidate->base_addr = base_socket->addr;
priv_assign_foundation (agent, candidate);
result = priv_add_local_candidate_pruned (component, candidate);
if (result) {
agent_signal_new_candidate (agent, candidate);
......@@ -352,7 +361,7 @@ discovery_add_peer_reflexive_candidate (
(NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE, 0, component_id);
candidate->stream_id = stream_id;
candidate->component_id = component_id;
priv_assign_foundation (agent, component, candidate);
priv_assign_foundation (agent, candidate);
candidate->addr = *address;
candidate->base_addr = base_socket->addr;
......@@ -471,7 +480,8 @@ static gboolean priv_discovery_tick (gpointer pointer)
if (agent->discovery_unsched_items)
--agent->discovery_unsched_items;
g_debug ("discovery - scheduling cand type %u addr %s and socket %d.\n", cand->type, cand->server_addr, cand->socket);
g_debug ("discovery - scheduling cand type %u addr %s and socket %d.\n",
cand->type, cand->server_addr, cand->socket);
if (cand->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE &&
cand->server_addr) {
......@@ -518,7 +528,6 @@ static gboolean priv_discovery_tick (gpointer pointer)
g_debug ("STUN discovery was cancelled, marking discovery done.");
cand->done = TRUE;
}
/* note: macro from sys/time.h but compatible with GTimeVal */
else if (priv_timer_expired (&cand->next_tick, &now)) {
int res = stun_bind_elapse (cand->stun_ctx);
if (res == EAGAIN) {
......@@ -526,8 +535,8 @@ static gboolean priv_discovery_tick (gpointer pointer)
unsigned int timeout = stun_bind_timeout (cand->stun_ctx);
/* note: convert from milli to microseconds for g_time_val_add() */
g_get_current_time (&cand->next_tick);
g_time_val_add (&cand->next_tick, timeout * 10);
cand->next_tick = now;
g_time_val_add (&cand->next_tick, timeout * 1000);
++not_done; /* note: retry later */
}
......
This diff is collapsed.
/*
* This file is part of the Nice GLib ICE library.
*
* Unit test for ICE full-mode related features.
*
* (C) 2007 Nokia Corporation. All rights reserved.
* Contact: Kai Vehmanen
*
......@@ -83,7 +85,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
/* XXX: dear compiler, these are for you: */
(void)agent; (void)stream_id; (void)component_id; (void)buf;
if ((int)user_data == 2) {
if ((intptr_t)user_data == 2) {
global_ragent_read = len;
g_main_loop_quit (global_mainloop);
}
......@@ -93,9 +95,9 @@ static void cb_candidate_gathering_done(NiceAgent *agent, gpointer data)
{
g_debug ("test-fullmode:%s: %p", G_STRFUNC, data);
if ((int)data == 1)
if ((intptr_t)data == 1)
global_lagent_gathering_done = TRUE;
else if ((int)data == 2)
else if ((intptr_t)data == 2)
global_ragent_gathering_done = TRUE;
if (global_lagent_gathering_done &&
......@@ -110,9 +112,9 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint
{
g_debug ("test-fullmode:%s: %p", __func__, data);
if ((int)data == 1)
if ((intptr_t)data == 1)
global_lagent_state = state;
else if ((int)data == 2)
else if ((intptr_t)data == 2)
global_ragent_state = state;
if (state == NICE_COMPONENT_STATE_READY)
......@@ -143,9 +145,9 @@ static void cb_new_selected_pair(NiceAgent *agent, guint stream_id, guint compon
{
g_debug ("test-fullmode:%s: %p", __func__, data);
if ((int)data == 1)
if ((intptr_t)data == 1)
++global_lagent_cands;
else if ((int)data == 2)
else if ((intptr_t)data == 2)
++global_ragent_cands;
/* XXX: dear compiler, these are for you: */
......@@ -165,9 +167,9 @@ static void cb_initial_binding_request_received(NiceAgent *agent, guint stream_i
{
g_debug ("test-fullmode:%s: %p", __func__, data);
if ((int)data == 1)
if ((intptr_t)data == 1)
global_lagent_ibr_received = TRUE;
else if ((int)data == 2)
else if ((intptr_t)data == 2)
global_ragent_ibr_received = TRUE;
/* XXX: dear compiler, these are for you: */
......@@ -240,16 +242,20 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
/* step: find out the local candidates of each agent */
priv_get_local_addr (ragent, rs_id, NICE_COMPONENT_TYPE_RTP, &raddr);
g_debug ("test-fullmode: local RTP port R %u", raddr.port);
g_debug ("test-fullmode: local RTP port R %u",
nice_address_get_port (&raddr));
priv_get_local_addr (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, &laddr);
g_debug ("test-fullmode: local RTP port L %u", laddr.port);
g_debug ("test-fullmode: local RTP port L %u",
nice_address_get_port (&laddr));
priv_get_local_addr (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, &raddr_rtcp);
g_debug ("test-fullmode: local RTCP port R %u", raddr_rtcp.port);
g_debug ("test-fullmode: local RTCP port R %u",
nice_address_get_port (&raddr_rtcp));
priv_get_local_addr (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP, &laddr_rtcp);
g_debug ("test-fullmode: local RTCP port L %u", laddr_rtcp.port);
g_debug ("test-fullmode: local RTCP port L %u",
nice_address_get_port (&laddr_rtcp));
/* step: pass the remote candidates to agents */
cands = g_slist_append (NULL, &cdes);
......@@ -358,7 +364,8 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N
for (i = cands; i; i = i->next) {
NiceCandidate *cand = i->data;
if (cand) {
g_debug ("test-fullmode: local port L %u", cand->addr.port);
g_debug ("test-fullmode: local port L %u",
nice_address_get_port (&cand->addr));
laddr = cand->addr;
}
}
......@@ -368,7 +375,8 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N
for (i = cands; i; i = i->next) {
NiceCandidate *cand = i->data;
if (cand) {
g_debug ("test-fullmode: local port R %u", cand->addr.port);
g_debug ("test-fullmode: local port R %u",
nice_address_get_port (&cand->addr));
raddr = cand->addr;
}
}
......@@ -467,7 +475,8 @@ static int run_full_test_control_conflict (NiceAgent *lagent, NiceAgent *ragent,
for (i = cands; i; i = i->next) {
NiceCandidate *cand = i->data;
if (cand) {
g_debug ("test-fullmode: local port L %u", cand->addr.port);
g_debug ("test-fullmode: local port L %u",
nice_address_get_port (&cand->addr));
laddr = cand->addr;
}
}
......
......@@ -85,7 +85,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
/* XXX: dear compiler, these are for you: */
(void)agent; (void)stream_id; (void)component_id; (void)buf;
if ((int)user_data == 2) {
if ((intptr_t)user_data == 2) {
global_ragent_read += len;
if (global_ragent_read == global_ragent_read_exit)
......@@ -97,9 +97,9 @@ static void cb_candidate_gathering_done(NiceAgent *agent, gpointer data)
{
g_debug ("test-restart:%s: %p", G_STRFUNC, data);
if ((int)data == 1)
if ((intptr_t)data == 1)
global_lagent_gathering_done = TRUE;
else if ((int)data == 2)
else if ((intptr_t)data == 2)
global_ragent_gathering_done = TRUE;
if (global_lagent_gathering_done &&
......@@ -114,9 +114,9 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint
{
g_debug ("test-restart:%s: %p", __func__, data);
if ((int)data == 1)
if ((intptr_t)data == 1)
global_lagent_state = state;
else if ((int)data == 2)
else if ((intptr_t)data == 2)
global_ragent_state = state;
if (state == NICE_COMPONENT_STATE_READY)
......@@ -147,9 +147,9 @@ static void cb_new_selected_pair(NiceAgent *agent, guint stream_id, guint compon
{
g_debug ("test-restart:%s: %p", __func__, data);
if ((int)data == 1)
if ((intptr_t)data == 1)
++global_lagent_cands;
else if ((int)data == 2)
else if ((intptr_t)data == 2)
++global_ragent_cands;
/* XXX: dear compiler, these are for you: */
......@@ -169,9 +169,9 @@ static void cb_initial_binding_request_received(NiceAgent *agent, guint stream_i
{
g_debug ("test-restart:%s: %p", __func__, data);
if ((int)data == 1)
if ((intptr_t)data == 1)
global_lagent_ibr_received = TRUE;
else if ((int)data == 2)
else if ((intptr_t)data == 2)
global_ragent_ibr_received = TRUE;
/* XXX: dear compiler, these are for you: */
......
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