Add debug details for detection init/cleanup
[connman] / src / agent.c
index 4765868..5ae62b2 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  Connection Manager
  *
- *  Copyright (C) 2007  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2007-2009  Intel Corporation. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -47,13 +47,11 @@ static void agent_free(void)
        agent_path = NULL;
 }
 
-static gboolean agent_disconnect(void *data)
+static void agent_disconnect(DBusConnection *connection, void *data)
 {
        DBG("data %p", data);
 
        agent_free();
-
-       return TRUE;
 }
 
 int __connman_agent_register(const char *sender, const char *path)
@@ -107,8 +105,13 @@ void __connman_agent_cleanup(void)
        if (agent_watch > 0)
                g_dbus_remove_watch(connection, agent_watch);
 
+       if (agent_path == NULL)
+               return;
+
        msg = dbus_message_new_method_call(agent_sender, agent_path,
                                        CONNMAN_AGENT_INTERFACE, "Release");
+       if (msg == NULL)
+               return;
 
        dbus_message_set_no_reply(msg, TRUE);