diff options
author | David Walter Seikel | 2014-05-18 13:27:05 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-18 13:27:05 +1000 |
commit | 5b3f4f59112aeb4c91806103c487ca3148b63486 (patch) | |
tree | 15f234b9ab9551b8129465a136430d16a4eff3b9 /src/libraries | |
parent | No need to say this is where the history is show now that it's actually being... (diff) | |
download | SledjHamr-5b3f4f59112aeb4c91806103c487ca3148b63486.zip SledjHamr-5b3f4f59112aeb4c91806103c487ca3148b63486.tar.gz SledjHamr-5b3f4f59112aeb4c91806103c487ca3148b63486.tar.bz2 SledjHamr-5b3f4f59112aeb4c91806103c487ca3148b63486.tar.xz |
Clean up the server startup and connection a bit.
Diffstat (limited to 'src/libraries')
-rw-r--r-- | src/libraries/SledjHamr.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c index 26df012..7fcede7 100644 --- a/src/libraries/SledjHamr.c +++ b/src/libraries/SledjHamr.c | |||
@@ -16,18 +16,10 @@ static Eina_Bool _add(void *data, int type, Ecore_Con_Event_Server_Del *ev) | |||
16 | { | 16 | { |
17 | struct _conct *this = data; | 17 | struct _conct *this = data; |
18 | 18 | ||
19 | ecore_event_handler_del(this->add); | ||
20 | ecore_event_handler_del(this->del); | ||
21 | |||
22 | if (this->addCb) | 19 | if (this->addCb) |
23 | { | ||
24 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, this->addCb, this->pointer); | ||
25 | this->addCb(this->pointer, type, ev); | 20 | this->addCb(this->pointer, type, ev); |
26 | } | ||
27 | if (this->dataCb) | 21 | if (this->dataCb) |
28 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, this->dataCb, this->pointer); | 22 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, this->dataCb, this->pointer); |
29 | if (this->delCb) | ||
30 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, this->delCb, this->pointer); | ||
31 | 23 | ||
32 | return ECORE_CALLBACK_RENEW; | 24 | return ECORE_CALLBACK_RENEW; |
33 | } | 25 | } |
@@ -44,11 +36,18 @@ static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev) | |||
44 | { | 36 | { |
45 | struct _conct *this = data; | 37 | struct _conct *this = data; |
46 | 38 | ||
47 | printf("FAILED to connect to server %s:%d, trying again in a second!\n", this->address, this->port); | 39 | printf("FAILED connection to server %s:%d, trying again in a second!\n", this->address, this->port); |
48 | ecore_event_handler_del(this->add); | 40 | ecore_event_handler_del(this->add); |
49 | ecore_event_handler_del(this->del); | 41 | ecore_event_handler_del(this->del); |
42 | |||
43 | if (this->delCb) | ||
44 | { | ||
45 | if (ECORE_CALLBACK_RENEW == this->delCb(this->pointer, type, ev)) | ||
46 | ecore_timer_add(1.0, _delTimer, this); | ||
47 | } | ||
48 | |||
50 | if (ev->server) ecore_con_server_del(ev->server); | 49 | if (ev->server) ecore_con_server_del(ev->server); |
51 | ecore_timer_add(1.0, _delTimer, this); | 50 | |
52 | return ECORE_CALLBACK_CANCEL; | 51 | return ECORE_CALLBACK_CANCEL; |
53 | } | 52 | } |
54 | 53 | ||