From 86525bd3660aa9afb4ddd4055c0aad5acc6c52d7 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 17 May 2014 11:29:38 +1000 Subject: Wait a second before extantz tries to reconnect. --- src/extantz/extantz.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 80306b9..74a0c58 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c @@ -104,6 +104,17 @@ static Eina_Bool _data(void *data, int type, Ecore_Con_Event_Server_Data *ev) return ECORE_CALLBACK_RENEW; } +// Forward declare a circular reference. +static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev); + +static Eina_Bool _serverDelTimer(void *data) +{ + globals *ourGlobals = data; + + ourGlobals->server = reachOut("127.0.0.1", 8211 + 1, ourGlobals, (Ecore_Event_Handler_Cb) _add, (Ecore_Event_Handler_Cb) _data, (Ecore_Event_Handler_Cb) _del); + return ECORE_CALLBACK_CANCEL; +} + static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev) { globals *ourGlobals = data; @@ -115,7 +126,7 @@ static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev) if (ourGlobals->running) { PW("Server dropped out, trying to reconnect."); - ourGlobals->server = reachOut("127.0.0.1", 8211 + 1, ourGlobals, (Ecore_Event_Handler_Cb) _add, (Ecore_Event_Handler_Cb) _data, (Ecore_Event_Handler_Cb) _del); + ecore_timer_add(1.0, _serverDelTimer, ourGlobals); } } -- cgit v1.1