diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_main.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/LuaSL/src/LuaSL_main.c b/LuaSL/src/LuaSL_main.c index 0efc65e..0aaf3c5 100644 --- a/LuaSL/src/LuaSL_main.c +++ b/LuaSL/src/LuaSL_main.c | |||
@@ -6,26 +6,13 @@ static int CPUs = 4; | |||
6 | static Eina_Strbuf *clientStream; | 6 | static Eina_Strbuf *clientStream; |
7 | 7 | ||
8 | 8 | ||
9 | Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) | 9 | static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) |
10 | { | 10 | { |
11 | ecore_con_client_timeout_set(ev->client, 0); | 11 | ecore_con_client_timeout_set(ev->client, 0); |
12 | return ECORE_CALLBACK_RENEW; | 12 | return ECORE_CALLBACK_RENEW; |
13 | } | 13 | } |
14 | 14 | ||
15 | Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) | 15 | static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) |
16 | { | ||
17 | gameGlobals *game = data; | ||
18 | |||
19 | if (ev->client) | ||
20 | { | ||
21 | PD("No more clients, exiting."); | ||
22 | ecore_con_client_del(ev->client); | ||
23 | ecore_main_loop_quit(); | ||
24 | } | ||
25 | return ECORE_CALLBACK_RENEW; | ||
26 | } | ||
27 | |||
28 | Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) | ||
29 | { | 16 | { |
30 | gameGlobals *game = data; | 17 | gameGlobals *game = data; |
31 | char SID[PATH_MAX]; | 18 | char SID[PATH_MAX]; |
@@ -81,6 +68,19 @@ Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev | |||
81 | return ECORE_CALLBACK_RENEW; | 68 | return ECORE_CALLBACK_RENEW; |
82 | } | 69 | } |
83 | 70 | ||
71 | static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) | ||
72 | { | ||
73 | gameGlobals *game = data; | ||
74 | |||
75 | if (ev->client) | ||
76 | { | ||
77 | PD("No more clients, exiting."); | ||
78 | ecore_con_client_del(ev->client); | ||
79 | ecore_main_loop_quit(); | ||
80 | } | ||
81 | return ECORE_CALLBACK_RENEW; | ||
82 | } | ||
83 | |||
84 | int main(int argc, char **argv) | 84 | int main(int argc, char **argv) |
85 | { | 85 | { |
86 | gameGlobals game; | 86 | gameGlobals game; |
@@ -98,8 +98,8 @@ int main(int argc, char **argv) | |||
98 | if ((game.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) | 98 | if ((game.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) |
99 | { | 99 | { |
100 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &game); | 100 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &game); |
101 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &game); | ||
102 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &game); | 101 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &game); |
102 | ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &game); | ||
103 | ecore_con_server_timeout_set(game.server, 0); | 103 | ecore_con_server_timeout_set(game.server, 0); |
104 | ecore_con_server_client_limit_set(game.server, -1, 0); | 104 | ecore_con_server_client_limit_set(game.server, -1, 0); |
105 | clientStream = eina_strbuf_new(); | 105 | clientStream = eina_strbuf_new(); |