efreet cache - handle corner case where efreetd keeps disconnecting

so an odd one. there is a socket, but nothing is actually listening on
it, but clients keep spinning launching efreetd's because the launch,
connect, then get a disconnect and try again immediately keeping
things spinning heavily, so add a delay of 0.5 sec before launchnig
another efreetd if the launch + connect fails and gets a disconnect
within 0.5 sec ... so give up for 0.5 sec before trying again to avoid
a runaway system.

@fix
This commit is contained in:
Carsten Haitzler 2016-12-26 13:06:35 +09:00
parent 44a70ab98c
commit a6f7b0f834
1 changed files with 24 additions and 3 deletions

View File

@ -132,11 +132,13 @@ _cb_server_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
return ECORE_CALLBACK_DONE;
}
static Ecore_Timer *reconnect_timer = NULL;
static Eina_Bool
_cb_server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
_cb_server_reconnect(void *data EINA_UNUSED)
{
IPC_HEAD(Del);
ipc = NULL;
if (reconnect_timer) ecore_timer_del(reconnect_timer);
reconnect_timer = NULL;
_ipc_launch();
if (ipc)
{
@ -148,6 +150,25 @@ _cb_server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
ecore_ipc_server_send(ipc, 1, 0, 0, 0, 0, s, len);
efreet_icon_extensions_refresh();
}
return EINA_FALSE;
}
static Eina_Bool
_cb_server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
static double last_del = 0.0;
double t;
IPC_HEAD(Del);
ipc = NULL;
t = ecore_time_get();
if ((t - last_del) < 0.5)
{
if (reconnect_timer) ecore_timer_del(reconnect_timer);
reconnect_timer = ecore_timer_add(0.5, _cb_server_reconnect, NULL);
}
else
_cb_server_reconnect(NULL);
last_del = t;
return ECORE_CALLBACK_DONE;
}