Commit 97beec8d authored by Youness Alaoui's avatar Youness Alaoui

Removed g_debug messages and replaced with nice_debug, en/disable-able with...

Removed g_debug messages and replaced with nice_debug, en/disable-able with nice_debug_en/disable API
parent 1d7714b6
......@@ -37,6 +37,8 @@ BUILT_SOURCES = \
CLEANFILES += $(BUILT_SOURCES)
libagent_la_SOURCES = \
debug.h \
debug.c \
candidate.h \
candidate.c \
component.h \
......
......@@ -55,6 +55,8 @@
#include <glib.h>
#include "debug.h"
#include "udp.h"
#include "udp-bsd.h"
#include "udp-turn.h"
......@@ -618,7 +620,7 @@ void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, gui
return;
if (component->state != state && state < NICE_COMPONENT_STATE_LAST) {
g_debug ("Agent %p : stream %u component %u STATE-CHANGE %u -> %u.", agent,
nice_debug ("Agent %p : stream %u component %u STATE-CHANGE %u -> %u.", agent,
stream_id, component_id, component->state, state);
component->state = state;
......@@ -662,7 +664,7 @@ priv_add_new_candidate_discovery (NiceAgent *agent,
cdisco->stream = stream;
cdisco->component = stream_find_component_by_id (stream, component_id);
cdisco->agent = agent;
g_debug ("Agent %p : Adding new srv-rflx candidate discovery %p\n", agent, cdisco);
nice_debug ("Agent %p : Adding new srv-rflx candidate discovery %p\n", agent, cdisco);
agent->discovery_list = modified_list;
++agent->discovery_unsched_items;
}
......@@ -706,7 +708,7 @@ nice_agent_add_stream (
modified_list = g_slist_append (agent->streams, stream);
if (modified_list) {
stream->id = agent->next_stream_id++;
g_debug ("Agent %p : allocating stream id %u (%p)", agent, stream->id, stream);
nice_debug ("Agent %p : allocating stream id %u (%p)", agent, stream->id, stream);
stream_initialize_credentials (stream, agent->rng);
......@@ -773,7 +775,7 @@ nice_agent_gather_candidates (
goto done;
}
g_debug ("Agent %p : In %s mode, starting candidate gathering.", agent, agent->full_mode ? "ICE-FULL" : "ICE-LITE");
nice_debug ("Agent %p : In %s mode, starting candidate gathering.", agent, agent->full_mode ? "ICE-FULL" : "ICE-LITE");
/* generate a local host candidate for each local address */
......@@ -960,7 +962,7 @@ static gboolean priv_add_remote_candidate (
/* step: check whether the candidate already exists */
candidate = component_find_remote_candidate(component, addr, transport);
if (candidate) {
g_debug ("Agent %p : Update existing remote candidate %p.", agent, candidate);
nice_debug ("Agent %p : Update existing remote candidate %p.", agent, candidate);
/* case 1: an existing candidate, update the attributes */
candidate->type = type;
if (base_addr)
......@@ -996,7 +998,7 @@ static gboolean priv_add_remote_candidate (
{
gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (addr, tmpbuf);
g_debug ("Agent %p : Adding remote candidate with addr [%s]:%u.", agent, tmpbuf,
nice_debug ("Agent %p : Adding remote candidate with addr [%s]:%u.", agent, tmpbuf,
nice_address_get_port (addr));
}
#endif
......@@ -1226,7 +1228,7 @@ nice_agent_set_remote_candidates (NiceAgent *agent, guint stream_id, guint compo
if (added > 0) {
gboolean res = conn_check_schedule_next (agent);
if (res != TRUE)
g_debug ("Agent %p : Warning: unable to schedule any conn checks!", agent);
nice_debug ("Agent %p : Warning: unable to schedule any conn checks!", agent);
}
g_static_rec_mutex_unlock (&agent->mutex);
......@@ -1259,7 +1261,7 @@ _nice_agent_recv (
if (len >= 0) {
gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&from, tmpbuf);
g_debug ("Agent %p : Packet received on local socket %u from [%s]:%u (%u octets).", agent,
nice_debug ("Agent %p : Packet received on local socket %u from [%s]:%u (%u octets).", agent,
udp_socket->fileno, tmpbuf, nice_address_get_port (&from), len);
}
#endif
......@@ -1276,7 +1278,7 @@ _nice_agent_recv (
if (nice_address_equal (&from, &component->turn_server)) {
GSList * i = NULL;
g_debug ("Agent %p : Packet received from TURN server candidate.", agent);
nice_debug ("Agent %p : Packet received from TURN server candidate.", agent);
for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *cand = i->data;
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED) {
......@@ -1568,7 +1570,7 @@ nice_agent_send (
gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&component->selected_pair.remote->addr, tmpbuf);
g_debug ("Agent %p : s%d:%d: sending %d bytes to [%s]:%d", agent, stream_id, component_id,
nice_debug ("Agent %p : s%d:%d: sending %d bytes to [%s]:%d", agent, stream_id, component_id,
len, tmpbuf,
nice_address_get_port (&component->selected_pair.remote->addr));
#endif
......@@ -1843,7 +1845,7 @@ priv_attach_stream_component_socket (NiceAgent *agent,
ctx = io_ctx_new (agent, stream, component, udp_socket);
g_source_set_callback (source, (GSourceFunc) nice_agent_g_source_cb,
ctx, (GDestroyNotify) io_ctx_free);
g_debug ("Agent %p : Attach source %p (stream %u).", agent, source, stream->id);
nice_debug ("Agent %p : Attach source %p (stream %u).", agent, source, stream->id);
g_source_attach (source, component->ctx);
component->gsources = g_slist_append (component->gsources, source);
}
......@@ -1878,7 +1880,7 @@ static void priv_detach_stream_component (Stream *stream, Component *component)
for (i = component->gsources; i; i = i->next) {
GSource *source = i->data;
g_debug ("Detach source %p (stream %u).", source, stream->id);
nice_debug ("Detach source %p (stream %u).", source, stream->id);
g_source_destroy (source);
}
......
......@@ -47,6 +47,8 @@
#include <string.h>
#include "debug.h"
#include "component.h"
#include "agent-priv.h"
......@@ -218,7 +220,7 @@ void component_update_selected_pair (Component *component, const CandidatePair *
{
g_assert (component);
g_assert (pair);
g_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%lu).",
nice_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;
......
This diff is collapsed.
/*
* This file is part of the Nice GLib ICE library.
*
* (C) 2008 Collabora Ltd.
* (C) 2008 Nokia Corporation. All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Nice GLib ICE library.
*
* The Initial Developers of the Original Code are Collabora Ltd and Nokia
* Corporation. All Rights Reserved.
*
* Contributors:
* Youness Alaoui, Collabora Ltd.
*
* Alternatively, the contents of this file may be used under the terms of the
* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
* case the provisions of LGPL are applicable instead of those above. If you
* wish to allow use of your version of this file only under the terms of the
* LGPL and not to allow others to use your version of this file under the
* MPL, indicate your decision by deleting the provisions above and replace
* them with the notice and other provisions required by the LGPL. If you do
* not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "debug.h"
#include <glib.h>
static int debug_enabled = 1;
void nice_debug_enable (void) {
debug_enabled = 1;
}
void nice_debug_disable (void) {
debug_enabled = 0;
}
void nice_debug (const char *fmt, ...)
{
va_list ap;
if (debug_enabled) {
va_start (ap, fmt);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, fmt, ap);
va_end (ap);
}
}
/*
* This file is part of the Nice GLib ICE library.
*
* (C) 2008 Collabora Ltd.
* (C) 2008 Nokia Corporation. All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Nice GLib ICE library.
*
* The Initial Developers of the Original Code are Collabora Ltd and Nokia
* Corporation. All Rights Reserved.
*
* Contributors:
* Youness Alaoui, Collabora Ltd.
*
* Alternatively, the contents of this file may be used under the terms of the
* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
* case the provisions of LGPL are applicable instead of those above. If you
* wish to allow use of your version of this file only under the terms of the
* LGPL and not to allow others to use your version of this file under the
* MPL, indicate your decision by deleting the provisions above and replace
* them with the notice and other provisions required by the LGPL. If you do
* not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL.
*/
#ifndef _DEBUG_H
#define _DEBUG_H
void nice_debug_enable (void);
void nice_debug_disable (void);
void nice_debug (const char *fmt, ...);
#endif /* _DEBUG_H */
......@@ -51,6 +51,8 @@
#include <glib.h>
#include "debug.h"
#include "agent.h"
#include "agent-priv.h"
#include "agent-signals-marshal.h"
......@@ -138,7 +140,7 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi
if (nice_address_equal (&c->base_addr, &candidate->base_addr) &&
nice_address_equal (&c->addr, &candidate->addr)) {
g_debug ("Candidate %p (component-id %u) redundant, ignoring.", candidate, component->id);
nice_debug ("Candidate %p (component-id %u) redundant, ignoring.", candidate, component->id);
return FALSE;
}
}
......@@ -638,7 +640,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
{
static int tick_counter = 0;
if (tick_counter++ % 50 == 0)
g_debug ("Agent %p : discovery tick #%d with list %p (1)", agent, tick_counter, agent->discovery_list);
nice_debug ("Agent %p : discovery tick #%d with list %p (1)", agent, tick_counter, agent->discovery_list);
}
#endif
......@@ -655,7 +657,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
{
gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&cand->server, tmpbuf);
g_debug ("Agent %p : discovery - scheduling cand type %u addr %s and socket %d.\n", agent,
nice_debug ("Agent %p : discovery - scheduling cand type %u addr %s and socket %d.\n", agent,
cand->type, tmpbuf, cand->socket);
}
#endif
......@@ -715,7 +717,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
g_get_current_time (&now);
if (cand->stun_message.buffer == NULL) {
g_debug ("Agent %p : STUN discovery was cancelled, marking discovery done.", agent);
nice_debug ("Agent %p : STUN discovery was cancelled, marking discovery done.", agent);
cand->done = TRUE;
}
else if (priv_timer_expired (&cand->next_tick, &now)) {
......@@ -726,7 +728,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
cand->done = TRUE;
cand->stun_message.buffer = NULL;
cand->stun_message.buffer_len = 0;
g_debug ("Agent %p : bind discovery timed out, aborting discovery item.", agent);
nice_debug ("Agent %p : bind discovery timed out, aborting discovery item.", agent);
break;
case 0:
{
......@@ -765,7 +767,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
}
if (not_done == 0) {
g_debug ("Agent %p : Candidate gathering FINISHED, stopping discovery timer.", agent);
nice_debug ("Agent %p : Candidate gathering FINISHED, stopping discovery timer.", agent);
discovery_free (agent);
......
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