From 4f5c0721cc88d7bec7876f67e3f122e96d60433f Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Fri, 8 Dec 2023 21:12:02 +0900 Subject: [PATCH] Adjust several operation's timeout threshold - focus-server listen timeout : 5s -> 30s ( 5s * 6) - focus-client connect timeout : 3s -> 30s (0.3s * 100) - keysound dbus method call : 2s -> 5s [Version] 0.13.26 [Issue Type] Robustness Change-Id: Ia06806d7d6dcc4f4f5322b32a802bace35bd5163 --- focus_server/mm_sound_mgr_focus_socket.c | 18 ++++++++++-------- mm_sound_focus_socket.c | 2 +- mm_sound_keysound.c | 2 +- packaging/libmm-sound.spec | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/focus_server/mm_sound_mgr_focus_socket.c b/focus_server/mm_sound_mgr_focus_socket.c index 162c552..beaaa67 100644 --- a/focus_server/mm_sound_mgr_focus_socket.c +++ b/focus_server/mm_sound_mgr_focus_socket.c @@ -63,6 +63,7 @@ enum { }; #define DEFAULT_FOCUS_THREAD_READY_TIMEOUT 5 +#define MAX_FOCUS_THREAD_READY_WAIT_RETRY 6 typedef struct mm_sound_focus_thread_data { const int *sockfd; @@ -560,8 +561,8 @@ void MMSoundMgrFocusSocketFini(int *sockfd) int MMSoundMgrFocusSocketReadyToWork(const int *sockfd) { - debug_enter(); focus_thread_data_t *thread_data = NULL; + int retry_remaining = MAX_FOCUS_THREAD_READY_WAIT_RETRY; if (*sockfd < 0) { debug_error("input param sockfd [%d] is not valid", *sockfd); @@ -577,14 +578,15 @@ int MMSoundMgrFocusSocketReadyToWork(const int *sockfd) goto ERROR_INTERNAL; } - if (!__focus_thread_ready_wait(thread_data, DEFAULT_FOCUS_THREAD_READY_TIMEOUT)) { - debug_error("focus thread is not ready for %u sec!!!", DEFAULT_FOCUS_THREAD_READY_TIMEOUT); - goto ERROR_INTERNAL; - } - - debug_leave(); + do { + if (__focus_thread_ready_wait(thread_data, DEFAULT_FOCUS_THREAD_READY_TIMEOUT)) { + debug_msg("[%d] wait success!!", retry_remaining); + return MM_ERROR_NONE; + } - return MM_ERROR_NONE; + debug_error("[%d] focus thread is not ready for %u sec!!!", + retry_remaining, DEFAULT_FOCUS_THREAD_READY_TIMEOUT); + } while (--retry_remaining > 0); ERROR_INTERNAL: __focus_thread_data_destroy(thread_data); diff --git a/mm_sound_focus_socket.c b/mm_sound_focus_socket.c index fa5083c..bb63879 100644 --- a/mm_sound_focus_socket.c +++ b/mm_sound_focus_socket.c @@ -28,7 +28,7 @@ #include "include/mm_sound_common.h" #include "include/mm_sound_focus_socket.h" -#define MAX_CONNECT_RETRY 10 +#define MAX_CONNECT_RETRY 100 #define RETRY_CONNECT_INTERVAL_US 300000 #define _FILL_SOCKET_PARAM(x_param, x_func_name, x_pid) \ diff --git a/mm_sound_keysound.c b/mm_sound_keysound.c index ee23fbc..fc7272e 100644 --- a/mm_sound_keysound.c +++ b/mm_sound_keysound.c @@ -73,7 +73,7 @@ static int __mm_sound_simple_pipe(const char *filename, int volume_config, const #define PA_BUS_NAME "org.pulseaudio.Server" #define PA_SOUND_PLAYER_OBJECT_PATH "/org/pulseaudio/SoundPlayer" #define PA_SOUND_PLAYER_INTERFACE "org.pulseaudio.SoundPlayer" -#define PA_SOUND_RESPONSE_TIMEOUT 2000 +#define PA_SOUND_RESPONSE_TIMEOUT 5000 static int __mm_sound_simple_dbus(const char *filename, int volume_config, const char *method); #endif /* USE_PIPE */ diff --git a/packaging/libmm-sound.spec b/packaging/libmm-sound.spec index bd648ab..83e57e8 100644 --- a/packaging/libmm-sound.spec +++ b/packaging/libmm-sound.spec @@ -1,6 +1,6 @@ Name: libmm-sound Summary: MMSound Package contains client lib and focus server binary -Version: 0.13.25 +Version: 0.13.26 Release: 0 Group: System/Libraries License: Apache-2.0 -- 2.7.4