Fix dbus delay when requesting hello
[platform/core/uifw/stt.git] / server / sttd_client_data.c
index 8029b57..f89349a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+*  Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -103,7 +103,11 @@ int sttd_client_add(int pid, int uid)
 
        if (NULL == g_client_list) {
                SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] Fail to add new client");
-               return -1;
+
+               free(info);
+               info = NULL;
+
+               return STTD_ERROR_OPERATION_FAILED;
        }
 
 #ifdef CLIENT_DATA_DEBUG
@@ -402,10 +406,18 @@ int sttd_client_get_list(int** uids, int* uid_count)
        int i = 0;
 
        iter = g_slist_nth(g_client_list, 0);
-       for (i = 0; i < count; i++) {
+       while (NULL != iter) {
+               if (NULL == iter->data) {
+                       count--;
+                       iter = g_slist_next(iter);
+                       continue;
+               }
+
                data = iter->data;
                tmp[i] = data->uid;
                iter = g_slist_next(iter);
+
+               i++;
        }
 
        *uids = tmp;
@@ -443,7 +455,7 @@ int stt_client_set_app_agreed(int uid)
 
        tmp = __client_get_item(uid);
        if (NULL == tmp) {
-               SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
+               SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
                return STTD_ERROR_INVALID_PARAMETER;
        }
 
@@ -460,10 +472,10 @@ bool stt_client_get_app_agreed(int uid)
 
        tmp = __client_get_item(uid);
        if (NULL == tmp) {
-               SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
+               SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
                return STTD_ERROR_INVALID_PARAMETER;
        }
 
        hnd = tmp->data;
        return hnd->app_agreed;
-}
\ No newline at end of file
+}