main: Call agent_init first
authorSamuel Ortiz <sameo@linux.intel.com>
Thu, 21 Nov 2013 01:11:55 +0000 (02:11 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 21 Nov 2013 01:11:55 +0000 (02:11 +0100)
agent_init will register the /org/neard name and if an adapter is
registered before /org/neard is registered, its parent will be "/". That
happens when starting neard with an adapter already plugged in.

src/main.c

index 1fd76fb..a2c3a84 100644 (file)
@@ -279,13 +279,13 @@ int main(int argc, char *argv[])
                exit(1);
        }
 
+       __near_agent_init();
        __near_tag_init();
        __near_device_init();
        __near_adapter_init();
        __near_ndef_init();
        __near_snep_core_init();
        __near_manager_init(conn);
-       __near_agent_init();
        __near_bluetooth_init();
 
        __near_plugin_init(option_plugin, option_noplugin);
@@ -303,7 +303,6 @@ int main(int argc, char *argv[])
 
        __near_plugin_cleanup();
 
-       __near_agent_cleanup();
        __near_bluetooth_cleanup();
        __near_manager_cleanup();
        __near_ndef_cleanup();
@@ -311,6 +310,7 @@ int main(int argc, char *argv[])
        __near_adapter_cleanup();
        __near_device_cleanup();
        __near_tag_cleanup();
+       __near_agent_cleanup();
        __near_netlink_cleanup();
 
        __near_dbus_cleanup();