aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_main.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-11 21:08:52 +1000
committerDavid Walter Seikel2012-02-11 21:08:52 +1000
commita488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69 (patch)
treef898cec7f89e1259277c295fd198e8385fc21384 /LuaSL/src/LuaSL_main.c
parentLuaSL_main is pretty small now, LuaSL_runner is mostly comment. Merge them. (diff)
downloadSledjHamr-a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69.zip
SledjHamr-a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69.tar.gz
SledjHamr-a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69.tar.bz2
SledjHamr-a488d73865ef0aa4cb40b3c2d5a4ed35b2e52d69.tar.xz
Neaten things up a bit.
Diffstat (limited to 'LuaSL/src/LuaSL_main.c')
-rw-r--r--LuaSL/src/LuaSL_main.c32
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;
6static Eina_Strbuf *clientStream; 6static Eina_Strbuf *clientStream;
7 7
8 8
9Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) 9static 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
15Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) 15static 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
28Eina_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
71static 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
84int main(int argc, char **argv) 84int 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();