[FIX] daemon cannot finish
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Mon, 16 Sep 2013 10:04:32 +0000 (14:04 +0400)
committerVitaliy Cherepanov <v.cherepanov@samsung.com>
Mon, 16 Sep 2013 10:04:32 +0000 (14:04 +0400)
if controll and data sockets are connect
daemon cannot finish correctly if phone display is off
next errors occurs
[ERR] (get_system_info):Failed to update system cpu data
[ERR] (samplingThread):Cannot get system info

Change-Id: Ic19127d3461434d81daa7c06ee1eee6d04d00398
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
daemon/daemon.c
daemon/main.c

index 9aec54055607cdc90450e7ebb1d05c63f366977e..633cd3691e4585ea1737a964d752a1a541293b03 100644 (file)
@@ -957,8 +957,6 @@ int daemonLoop()
                goto END_EFD;
        }
 
-       //init all file descriptors
-       init_system_file_descriptors();
 
        // handler loop
        while (1) {
@@ -1130,6 +1128,5 @@ END_EFD:
        close(manager.efd);
 END_EVENT:
        free(events);
-       close_system_file_descriptors();
        return return_value;
 }
index 4b69b27e91e701a4acbda62eeba25f21306dee04..5c5317c724794283efd73e59730304270dcbdab9 100644 (file)
@@ -427,6 +427,8 @@ int main()
        if (err)
                return 1;
 
+       //init all file descriptors
+       init_system_file_descriptors();
        //daemon work
        //FIX ME remove samplingThread it is only for debug
        //samplingThread(NULL);
@@ -434,6 +436,9 @@ int main()
        LOGI("daemon loop finished\n");
        stop_all();
        finalizeManager();
+
+       close_system_file_descriptors();
+
        LOGI("main finished\n");
        return 0;
 }