/* connect to the panel agent as the active helper client */
if (!m_impl->socket_active.connect (address)) return -1;
- if (!scim_socket_open_connection (magic,
+ open_connection_retries = 0;
+ while (!scim_socket_open_connection (magic,
String ("Helper_Active"),
String ("Panel"),
m_impl->socket_active,
timeout)) {
- m_impl->socket_active.close ();
- ISF_SAVE_LOG ("Helper_Active scim_socket_open_connection() failed %d\n", timeout);
- return -1;
+ if (++open_connection_retries > 10) {
+ m_impl->socket_active.close ();
+ std::cerr << "Helper_Active scim_socket_open_connection () is failed!!!\n";
+ ISF_LOG ("Helper_Active scim_socket_open_connection () is failed!!!\n");
+ ISF_SAVE_LOG ("Helper_Active scim_socket_open_connection failed, %d\n", timeout);
+
+ return -1;
+ }
+
+ /* Retry after re-connecting the socket */
+ if (m_impl->socket_active.is_connected ())
+ m_impl->socket_active.close ();
+
+ /* This time, just retry atmost 2 seconds */
+ i = 0;
+ while (!m_impl->socket_active.connect (address) && ++i < 10) {
+ scim_usleep (200000);
+ }
}
m_impl->magic_active = magic;