Commit 47e6a9b9 authored by Youness Alaoui's avatar Youness Alaoui

Allow nice_debug_enable and nice_debug_disable to be called before the first...

Allow nice_debug_enable and nice_debug_disable to be called before the first NiceAgent is instanciated
parent 69888aa8
...@@ -61,40 +61,46 @@ static const GDebugKey keys[] = { ...@@ -61,40 +61,46 @@ static const GDebugKey keys[] = {
void nice_debug_init () void nice_debug_init ()
{ {
static gboolean debug_initialized = FALSE;
const gchar *flags_string; const gchar *flags_string;
guint flags; guint flags;
flags_string = g_getenv ("NICE_DEBUG"); if (!debug_initialized) {
debug_initialized = TRUE;
nice_debug_disable (TRUE); flags_string = g_getenv ("NICE_DEBUG");
if (flags_string != NULL) { nice_debug_disable (TRUE);
flags = g_parse_debug_string (flags_string, keys, 4);
if (flags & NICE_DEBUG_NICE) if (flags_string != NULL) {
nice_debug_enable (FALSE); flags = g_parse_debug_string (flags_string, keys, 4);
if (flags & NICE_DEBUG_STUN)
stun_debug_enable ();
/* Set verbose before normal so that if we use 'all', then only if (flags & NICE_DEBUG_NICE)
normal debug is enabled, we'd need to set pseudotcp-verbose without the nice_debug_enable (FALSE);
pseudotcp flag in order to actually enable verbose pseudotcp */ if (flags & NICE_DEBUG_STUN)
if (flags & NICE_DEBUG_PSEUDOTCP_VERBOSE) stun_debug_enable ();
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_VERBOSE);
if (flags & NICE_DEBUG_PSEUDOTCP)
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_NORMAL);
/* Set verbose before normal so that if we use 'all', then only
normal debug is enabled, we'd need to set pseudotcp-verbose without the
pseudotcp flag in order to actually enable verbose pseudotcp */
if (flags & NICE_DEBUG_PSEUDOTCP_VERBOSE)
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_VERBOSE);
if (flags & NICE_DEBUG_PSEUDOTCP)
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_NORMAL);
}
} }
} }
void nice_debug_enable (gboolean with_stun) void nice_debug_enable (gboolean with_stun)
{ {
nice_debug_init ();
debug_enabled = 1; debug_enabled = 1;
if (with_stun) if (with_stun)
stun_debug_enable (); stun_debug_enable ();
} }
void nice_debug_disable (gboolean with_stun) void nice_debug_disable (gboolean with_stun)
{ {
nice_debug_init ();
debug_enabled = 0; debug_enabled = 0;
if (with_stun) if (with_stun)
stun_debug_disable (); stun_debug_disable ();
......
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