diff options
author | Mikhail Zabaluev <mikhail.zabaluev@nokia.com> | 2011-03-04 20:18:20 +0200 |
---|---|---|
committer | Mikhail Zabaluev <mikhail.zabaluev@nokia.com> | 2011-03-04 20:18:20 +0200 |
commit | c97757937ad35bbfa4104b37082965b87a1e27c1 (patch) | |
tree | 52b2526633ff7c3afaa082b2a63ecba759dd1dc0 /src | |
parent | 5d568b09068ee1705ed1e35f12044f97e5a1ee85 (diff) |
Moving log init/shutdown back to the connection manager lifecycle
Doing the TpDebugSender business outside of the mainloop may not be such
a bright idea.
Diffstat (limited to 'src')
-rw-r--r-- | src/sip-connection-manager.c | 16 | ||||
-rw-r--r-- | src/telepathy-rakia.c | 14 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/sip-connection-manager.c b/src/sip-connection-manager.c index 0e6a22b..5aba0ea 100644 --- a/src/sip-connection-manager.c +++ b/src/sip-connection-manager.c @@ -31,11 +31,13 @@ #include <dbus/dbus-protocol.h> +#include <telepathy-glib/debug-sender.h> #include <telepathy-glib/errors.h> #include <telepathy-glib/svc-connection-manager.h> #include <rakia/sofia-decls.h> #include <sofia-sip/su_glib.h> +#include <sofia-sip/su_log.h> #include "protocol.h" #include "sip-connection-manager.h" @@ -51,6 +53,7 @@ G_DEFINE_TYPE(RakiaConnectionManager, rakia_connection_manager, struct _RakiaConnectionManagerPrivate { su_root_t *sofia_root; + TpDebugSender *debug_sender; }; #define TPSIP_CONNECTION_MANAGER_GET_PRIVATE(obj) ((obj)->priv) @@ -64,6 +67,11 @@ rakia_connection_manager_init (RakiaConnectionManager *obj) obj->priv = priv; + priv->debug_sender = tp_debug_sender_dup (); + g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN); + + su_log_redirect (NULL, rakia_sofia_log_handler, NULL); + priv->sofia_root = su_glib_root_create(obj); su_root_threading(priv->sofia_root, 0); source = su_root_gsource(priv->sofia_root); @@ -119,5 +127,13 @@ rakia_connection_manager_finalize (GObject *object) g_source_destroy(source); su_root_destroy(priv->sofia_root); + rakia_debug_free (); + + if (priv->debug_sender != NULL) + { + g_object_unref (priv->debug_sender); + priv->debug_sender = NULL; + } + G_OBJECT_CLASS (rakia_connection_manager_parent_class)->finalize (object); } diff --git a/src/telepathy-rakia.c b/src/telepathy-rakia.c index e0f3870..4ed4906 100644 --- a/src/telepathy-rakia.c +++ b/src/telepathy-rakia.c @@ -31,10 +31,6 @@ #include "sip-connection-manager.h" #include <telepathy-glib/run.h> #include <telepathy-glib/debug.h> -#include <telepathy-glib/debug-sender.h> - -#include <rakia/sofia-decls.h> -#include <sofia-sip/su_log.h> static TpBaseConnectionManager * construct_cm (void) @@ -48,7 +44,6 @@ int main (int argc, char** argv) { int status; - TpDebugSender *debug_sender; guint fatal_mask; fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); @@ -66,17 +61,8 @@ main (int argc, char** argv) tp_debug_divert_messages (g_getenv ("TPSIP_LOGFILE")); - debug_sender = tp_debug_sender_dup (); - g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN); - - su_log_redirect (NULL, rakia_sofia_log_handler, NULL); - status = tp_run_connection_manager ("telepathy-rakia", VERSION, construct_cm, argc, argv); - rakia_debug_free (); - - g_object_unref (debug_sender); - return status; } |