[FIX] stop profiling if application was closed
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Wed, 23 Oct 2013 13:30:22 +0000 (17:30 +0400)
committerVitaliy Cherepanov <v.cherepanov@samsung.com>
Wed, 23 Oct 2013 13:37:38 +0000 (17:37 +0400)
if no application avail for profiling we should stop profiling

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

index 36e3b53..8cdbfbd 100644 (file)
@@ -605,8 +605,12 @@ static int target_event_stop_handler(int epollfd, int index, uint64_t msg)
 
        setEmptyTargetSlot(index);
        // all target client are closed
-       if (0 == __sync_sub_and_fetch(&manager.target_count, 1))
+       if (0 == __sync_sub_and_fetch(&manager.target_count, 1)) {
+               LOGI("all targets are stopped\n");
+               if (stop_all() != ERR_NO)
+                       LOGE("Stop failed\n");
                return -11;
+       }
 
        return 0;
 }
@@ -626,7 +630,7 @@ static int target_event_handler(int epollfd, int index, uint64_t msg)
        if (msg & EVENT_STOP || msg & EVENT_ERROR)
                err = target_event_stop_handler(epollfd, index, msg);
 
-       return 0;
+       return err;
 }
 
 #ifndef LOCALTEST