Fix wrong error message 91/202991/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 8 Apr 2019 11:31:48 +0000 (20:31 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 9 Apr 2019 02:28:30 +0000 (11:28 +0900)
Change-Id: I3b9a55002c59ca1a44e15a153b896c2014009d98
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/autofill-daemon.c

index 097c86b..a480f29 100644 (file)
@@ -45,6 +45,7 @@ typedef struct {
 
 static GList *__client_list = NULL;
 static Ecore_Timer *g_connect_timer = NULL;
+static bool g_connected = false;
 
 static bool connect_service();
 
@@ -351,8 +352,13 @@ static int __auth_info_request_cb(rpc_port_stub_AutofillAppPort_context_h contex
 {
     char *sender = NULL;
 
+    if (!g_connected) {
+        LOGW("Not connected to autofill service");
+        return 0;
+    }
+
     if (!svc_rpc_h) {
-        LOGW("Not initialized");
+        LOGW("RPC port for autofill service is not created");
         return 0;
     }
 
@@ -394,8 +400,13 @@ static int __autofill_fill_request_cb(rpc_port_stub_AutofillAppPort_context_h co
     char *sender = NULL;
     char *view_id = NULL;
 
+    if (!g_connected) {
+        LOGW("Not connected to autofill service");
+        return 0;
+    }
+
     if (!svc_rpc_h) {
-        LOGW("Not initialized");
+        LOGW("RPC port for autofill service is not created");
         return 0;
     }
 
@@ -433,8 +444,13 @@ static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, int cont
     char *sender = NULL;
     char *view_id = NULL;
 
+    if (!g_connected) {
+        LOGW("Not connected to autofill service");
+        return 0;
+    }
+
     if (!svc_rpc_h) {
-        LOGW("Not initialized");
+        LOGW("RPC port for autofill service is not created");
         return 0;
     }
 
@@ -662,6 +678,8 @@ static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data)
     int r = rpc_port_proxy_AutofillSvcPort_invoke_Register(h, auth_info_cb_h, fill_response_received_cb_h, error_info_cb_h);
     if (r != 0)
         LOGD("Failed to invoke Register");
+
+    g_connected = true;
 }
 
 static Eina_Bool connect_timer_cb(void *data)
@@ -696,6 +714,8 @@ static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_dat
         error_info_cb_h = NULL;
     }
 
+    g_connected = false;
+
     // try to connect again
     if (!connect_service()) {
         if (g_connect_timer)
@@ -820,6 +840,11 @@ static bool connect_service()
     };
 
     if (svc_rpc_h) {
+        LOGI("connecting..\n");
+        return true;
+    }
+
+    if (g_connected) {
         LOGI("already connected\n");
         return true;
     }
@@ -850,7 +875,7 @@ static bool connect_service()
     }
 
     if (ret != RPC_PORT_ERROR_NONE) {
-        LOGW("Failed to create rpc port. err = %#x", ret);
+        LOGW("Failed to create rpc port. error code: %#x, message: %s", ret, get_error_message(ret));
         free(active_autofill_service_id);
         return false;
     }
@@ -859,7 +884,7 @@ static bool connect_service()
     free(active_autofill_service_id);
     ret = rpc_port_proxy_AutofillSvcPort_connect(svc_rpc_h);
     if (ret != RPC_PORT_ERROR_NONE) {
-        LOGW("Failed to connect. err = %#x", ret);
+        LOGW("Failed to connect. error code: %#x, message: %s", ret, get_error_message(ret));
         return false;
     }