*/
int isf_control_prelaunch_ise (void);
+/**
+ * @brief Sets the timeout for socket connect requests.
+ *
+ * @remarks If the socket connection fails, retry the connection internally until the run-time has reached the timeout.
+ *
+ * @since_tizen 5.0
+ *
+ * @param[in] msec The socket connect timeout. The timeout has a minimum unit of 100ms.
+ *
+ * @return 0 on success, otherwise return -1
+ */
+int isf_control_set_socket_connect_timeout (int msec);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include <string.h>
#include "scim.h"
+#define MINIMUM_TIMEOUT 100
namespace scim
{
typedef Signal1<void, int> IMControlClientSignalVoid;
+static int m_retry_count = 600;
#if ENABLE_LAZY_LAUNCH
static bool check_panel (const String &display)
ret = m_socket_imclient2panel.connect (addr);
ret2 = m_socket_panel2imclient.connect (addr);
if (!ret) {
- scim_usleep (100000);
#if ENABLE_LAZY_LAUNCH
if (!check_socket_frontend ())
launch_socket_frontend ();
if (!check_panel (display))
scim_launch_panel (true, "socket", display, NULL);
#endif
- for (int i = 0; i < 200; ++i) {
- if (m_socket_imclient2panel.connect (addr)) {
- ret = true;
- break;
- }
- scim_usleep (100000);
+ if (m_socket_imclient2panel.connect (addr)) {
+ ret = true;
+ break;
}
}
m_socket_imclient2panel.close ();
m_socket_panel2imclient.close ();
- if (count++ >= 3) break;
+ if (count++ >= m_retry_count) break;
scim_usleep (100000);
}
return false;
}
}
+
+ void set_socket_connect_timeout (int msec) {
+ if (msec < MINIMUM_TIMEOUT)
+ m_retry_count = 1;
+ else
+ m_retry_count = msec / MINIMUM_TIMEOUT;
+ }
};
IMControlClient::IMControlClient ()
{
return m_impl->launch_helper_ise ();
}
+
+void IMControlClient::set_socket_connect_timeout (int msec)
+{
+ return m_impl->set_socket_connect_timeout (msec);
+}
};
/*