Remove duplicated logic int stop behavior 12/290312/2
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 20 Mar 2023 10:25:44 +0000 (19:25 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 6 Apr 2023 09:44:43 +0000 (09:44 +0000)
- Issue:
In __stop_by_silence() function, there is duplicated logic.

- Solution:
In previous code, __stop_by_silence() function send message to client
according to the return value of sttd_server_stop(). However,
sttd_server_stop() is already send message when it is return STATE DONE
value. Thus, the bahvior on __stop_by_silence() is actually unvaluable.
Thus, this patch removes that code to reduce duplicated logic.

Change-Id: I61948b1ad6fe6d243b1240fb8ae484639b072e0e
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
server/sttd_server.c

index 3c4b3e8..b096694 100644 (file)
@@ -60,23 +60,11 @@ Eina_Bool __stop_by_silence(void *data)
 
        unsigned int uid = stt_client_get_current_recognition();
 
-       int ret;
        if (STT_INVALID_UID != uid) {
-               ret = sttd_server_stop(uid);
-               if (0 > ret) {
+               int ret = sttd_server_stop(uid);
+               if (STTD_ERROR_NONE != ret) {
+                       SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] Fail to stop recording");
                        __cancel_recognition_internal();
-                       return EINA_FALSE;
-               }
-
-               if (STTD_RESULT_STATE_DONE == ret) {
-                       ret = sttdc_send_set_state(uid, (int)APP_STATE_PROCESSING);
-                       if (0 != ret) {
-                               SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send state : result(%d)", ret);
-
-                               /* Remove client */
-                               sttd_server_finalize(uid);
-                               stt_client_unset_current_recognition();
-                       }
                }
        } else {
                SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] uid is NOT valid");