[Internal: changed] remove log, daemon check api added
authorsanghyuk Ko <sanghyuk.ko@samsung.com>
Fri, 29 Mar 2013 12:47:30 +0000 (21:47 +0900)
committersanghyuk Ko <sanghyuk.ko@samsung.com>
Fri, 29 Mar 2013 12:47:30 +0000 (21:47 +0900)
[Problem]
-
[Cause]
-
[Solution]
- When dbus-call failed, log removed
- daemon check api add

Change-Id: Ibbc623a3e63b59b0d9abbf3e80ed3caf31469606

src/framework/CMakeLists.txt
src/framework/event/oma_ds_api.c

index 9ef80df..f1c4e21 100755 (executable)
@@ -27,6 +27,7 @@ pkg_check_modules(LPKGS REQUIRED
                                        libwbxml2
                                        dlog
                                        dbus-glib-1
+                                       sysman
                                        )
 
 #############################################
index 2e94ba3..951f3b5 100755 (executable)
@@ -21,6 +21,7 @@
 
 #include <glib.h>
 #include <dbus/dbus-glib.h>
+#include <sysman_managed.h>
 
 #ifndef SYNC_AGENT_LOG
 #undef LOG_TAG
@@ -467,7 +468,6 @@ static int _launch_omads_agent(void)
 
        DBusGConnection *connection = NULL;
        DBusGProxy *dbus_proxy = NULL;
-       gboolean bResult = FALSE;
 
        g_type_init();
 
@@ -485,17 +485,7 @@ static int _launch_omads_agent(void)
        _DEBUG_INFO("dbus_proxy %x", dbus_proxy);
 
        //dbus_g_proxy_call_no_reply(dbus_proxy, "Hello_Agent", G_TYPE_INVALID);
-       bResult = dbus_g_proxy_call(dbus_proxy, "Hello_Agent", &error, G_TYPE_INVALID, G_TYPE_INVALID);
-
-       if (bResult == FALSE) {
-               _DEBUG_ERROR("dbus_g_proxy_call failed: %s\n", error->message);
-               g_error_free(error);
-               g_object_unref(dbus_proxy);
-               dbus_g_connection_unref(connection);
-
-               _INNER_FUNC_EXIT;
-               return -1;
-       }
+       dbus_g_proxy_call(dbus_proxy, "Hello_Agent", &error, G_TYPE_INVALID, G_TYPE_INVALID);
 
        g_object_unref(dbus_proxy);
        dbus_g_connection_unref(connection);
@@ -551,15 +541,21 @@ EXPORT_API sync_agent_ds_error_e sync_agent_ds_init()
        sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
        sync_agent_init_error_e init_error = SYNC_AGENT_INIT_SUCCESS;
        int ret = -1;
+       int pid = -1;
 
-       ret = _launch_omads_agent();
+       _DEBUG_INFO("before sysman_get_pid");
+       pid = sysman_get_pid("/usr/bin/oma-ds-agent");
+       _DEBUG_INFO("oma-ds-agent pid [%d]", pid);
 
-       if (ret < 0 ) {
-               _DEBUG_ERROR("_launch_omads_agent() failed !!");
-               result = SYNC_AGENT_DS_FAIL;
+       if(pid == -1 ) {
+               ret = _launch_omads_agent();
+               if (ret < 0 ) {
+                       _DEBUG_ERROR("_launch_omads_agent() failed !!");
+                       result = SYNC_AGENT_DS_FAIL;
 
-               _EXTERN_FUNC_EXIT;
-               return result;
+                       _EXTERN_FUNC_EXIT;
+                       return result;
+               }
        }
 
        init_error = sync_agent_init(OMA_DS_CONFIG_FILE);
@@ -1697,6 +1693,7 @@ EXPORT_API sync_agent_ds_error_e sync_agent_ds_deinit()
 
        sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
        sync_agent_deinit_error_e deinit = SYNC_AGENT_DEINIT_SUCCESS;
+
        int ret = -1;
 
        ret = _kill_omads_agent();