fix a defect of app2sd-server termination before processing is done. 66/92466/1 accepted/tizen/common/20161017.170332 accepted/tizen/ivi/20161017.233858 accepted/tizen/mobile/20161017.233811 accepted/tizen/tv/20161017.233826 accepted/tizen/wearable/20161017.233840 submit/tizen/20161017.073552
authorjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 17 Oct 2016 06:06:10 +0000 (15:06 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 17 Oct 2016 06:06:10 +0000 (15:06 +0900)
- defect : app2sd-server could be terminated by timeout from previous request.

Change-Id: I089d1a23a9dbb93b3980954ef3164480f27811cf
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
plugin/app2sd/src/app2sd_server.c

index 0c0af15..04afa1e 100644 (file)
 
 #define APPFW_UID 301
 
+int processing_busy_cnt;
+
 GMainLoop *app2sd_mainloop = NULL;
 
 gboolean __exit_app2sd_server(void *data)
 {
-       _D("exit app2sd_server");
-
-       g_main_loop_quit(app2sd_mainloop);
+       if (processing_busy_cnt <= 0) {
+               _D("exit app2sd_server");
+               g_main_loop_quit(app2sd_mainloop);
+               return FALSE;
+       }
 
-       return FALSE;
+       _D("processing busy, count(%d)", processing_busy_cnt);
+       return TRUE;
 }
 
 static int __app2sd_get_sender_unixinfo(GDBusConnection *conn,
@@ -716,6 +721,8 @@ static void handle_method_call(GDBusConnection *connection,
 {
        uid_t sender_uid = -1;
 
+       processing_busy_cnt++;
+
        sender_uid = (uid_t)__app2sd_get_sender_uid(connection, sender);
 
        if (g_strcmp0(method_name, "PreAppInstall") == 0) {
@@ -760,6 +767,7 @@ static void handle_method_call(GDBusConnection *connection,
        }
 
        g_timeout_add_seconds(5, __exit_app2sd_server, NULL);
+       processing_busy_cnt--;
 }
 
 static const GDBusInterfaceVTable interface_vtable = {
@@ -826,8 +834,6 @@ static int __app2sd_server_init()
                return -1;
        }
 
-       /* add timer */
-
        return 0;
 }