aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-17 11:11:47 +1000
committerDavid Walter Seikel2014-05-17 11:11:47 +1000
commitb069decfcd8479ef0c93550667556c96738b07b9 (patch)
treefa221f5c62617d384985cdd34e9ab1fdf68d6596 /src
parentUse the new server connector, and some related movements. (diff)
downloadSledjHamr-b069decfcd8479ef0c93550667556c96738b07b9.zip
SledjHamr-b069decfcd8479ef0c93550667556c96738b07b9.tar.gz
SledjHamr-b069decfcd8479ef0c93550667556c96738b07b9.tar.bz2
SledjHamr-b069decfcd8479ef0c93550667556c96738b07b9.tar.xz
Don't sleep to wait for reconnecting, use a timer instead.
Diffstat (limited to 'src')
-rw-r--r--src/libraries/SledjHamr.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c
index 17b7610..26df012 100644
--- a/src/libraries/SledjHamr.c
+++ b/src/libraries/SledjHamr.c
@@ -32,16 +32,23 @@ static Eina_Bool _add(void *data, int type, Ecore_Con_Event_Server_Del *ev)
32 return ECORE_CALLBACK_RENEW; 32 return ECORE_CALLBACK_RENEW;
33} 33}
34 34
35static Eina_Bool _delTimer(void *data)
36{
37 struct _conct *this = data;
38
39 reachOut(this->address, this->port, this->pointer, this->addCb, this->dataCb, this->delCb);
40 return ECORE_CALLBACK_CANCEL;
41}
42
35static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev) 43static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev)
36{ 44{
37 struct _conct *this = data; 45 struct _conct *this = data;
38 46
39 printf("FAILED to connect to server %s:%d, trying again!\n", this->address, this->port); 47 printf("FAILED to connect to server %s:%d, trying again in a second!\n", this->address, this->port);
40 ecore_event_handler_del(this->add); 48 ecore_event_handler_del(this->add);
41 ecore_event_handler_del(this->del); 49 ecore_event_handler_del(this->del);
42 if (ev->server) ecore_con_server_del(ev->server); 50 if (ev->server) ecore_con_server_del(ev->server);
43 sleep(1); 51 ecore_timer_add(1.0, _delTimer, this);
44 reachOut(this->address, this->port, this->pointer, this->addCb, this->dataCb, this->delCb);
45 return ECORE_CALLBACK_CANCEL; 52 return ECORE_CALLBACK_CANCEL;
46} 53}
47 54