aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-01-01 04:32:00 +1000
committerDavid Walter Seikel2016-01-01 04:32:00 +1000
commit6ce603a921ea1a6a2e78b9982a07e229d747108e (patch)
tree7a7cc16910ff837fdb0a5afda675c2e97097ce01
parentSlip an llDialog() into the simple test LSL script, so we can test llDialag e... (diff)
downloadSledjHamr-6ce603a921ea1a6a2e78b9982a07e229d747108e.zip
SledjHamr-6ce603a921ea1a6a2e78b9982a07e229d747108e.tar.gz
SledjHamr-6ce603a921ea1a6a2e78b9982a07e229d747108e.tar.bz2
SledjHamr-6ce603a921ea1a6a2e78b9982a07e229d747108e.tar.xz
Refactor the client / server stuff, though only partially converted so far.
This may not build or run well, it's late, I'm tired.
-rw-r--r--src/libraries/SledjHamr.c327
-rw-r--r--src/libraries/SledjHamr.h47
-rw-r--r--src/love/love.c121
3 files changed, 384 insertions, 111 deletions
diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c
index 871b294..3445e52 100644
--- a/src/libraries/SledjHamr.c
+++ b/src/libraries/SledjHamr.c
@@ -1,6 +1,7 @@
1// This might become nails, since at the moment it's only got comms stuff in it. 1// This might become nails, since at the moment it's only got comms stuff in it.
2 2
3#include <unistd.h> 3#include <unistd.h>
4#include "LumbrJack.h"
4#include "SledjHamr.h" 5#include "SledjHamr.h"
5 6
6 7
@@ -62,35 +63,6 @@ static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev)
62 return ECORE_CALLBACK_CANCEL; 63 return ECORE_CALLBACK_CANCEL;
63} 64}
64 65
65Ecore_Con_Server *reachOut(char *address, int port, void *data, Ecore_Event_Handler_Cb _addCb, Ecore_Event_Handler_Cb _dataCb, Ecore_Event_Handler_Cb _delCb)
66{
67 Ecore_Con_Server *server = NULL;
68 struct _conct *this = malloc(sizeof(struct _conct));
69 int count = 0;
70
71 this->address = address;
72 this->port = port;
73 this->pointer = data;
74 this->addCb = _addCb;
75 this->dataCb = _dataCb;
76 this->delCb = _delCb;
77 // This loop is overkill I think.
78 while ((!server) && (10 > count))
79 {
80 if ((server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, address, port, this->pointer)))
81 {
82 this->add = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb) _add, this);
83 this->del = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) _del, this);
84 }
85 count++;
86 }
87
88 if (!server)
89 printf("Failed to connect to server %s:%d!\n", this->address, this->port);
90
91 return server;
92}
93
94void *addMessage(Eina_Clist *list, size_t size, const char *message, ...) 66void *addMessage(Eina_Clist *list, size_t size, const char *message, ...)
95{ 67{
96 va_list args; 68 va_list args;
@@ -123,6 +95,7 @@ void sendBack(Ecore_Con_Client *client, const char *SID, const char *message, ..
123 va_end(args); 95 va_end(args);
124 buf[length++] = '\n'; 96 buf[length++] = '\n';
125 buf[length] = '\0'; 97 buf[length] = '\0';
98// printf("sendBack(%s)", buf);
126 ecore_con_client_send(client, buf, length); 99 ecore_con_client_send(client, buf, length);
127 ecore_con_client_flush(client); 100 ecore_con_client_flush(client);
128} 101}
@@ -140,6 +113,302 @@ void sendForth(Ecore_Con_Server *server, const char *SID, const char *message, .
140 va_end(args); 113 va_end(args);
141 buf[length++] = '\n'; 114 buf[length++] = '\n';
142 buf[length] = '\0'; 115 buf[length] = '\0';
116// printf("sendForth(%s)", buf);
143 ecore_con_server_send(server, buf, length); 117 ecore_con_server_send(server, buf, length);
144 ecore_con_server_flush(server); 118 ecore_con_server_flush(server);
145} 119}
120
121
122
123
124static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, void *ev)
125{
126 Connection *connection = data;
127 char SID[PATH_MAX];
128 const char *command;
129 char *ext;
130
131 if (NULL == connection->stream)
132 connection->stream = eina_strbuf_new();
133
134 eina_strbuf_append_length(connection->stream, evData, evSize);
135 command = eina_strbuf_string_get(connection->stream);
136 while ((ext = index(command, '\n')))
137 {
138 int length = ext - command;
139
140 strncpy(SID, command, length + 1);
141 SID[length] = '\0';
142 eina_strbuf_remove(connection->stream, 0, length + 1);
143 ext = index(SID, '.');
144 if (ext)
145 {
146 ext[0] = '\0';
147 command = ext + 1;
148 ext = index(SID, '(');
149 if (ext)
150 {
151 streamParser func = eina_hash_find(connection->commands, command);
152//PW("COMMAND - %s", command);
153
154 ext[0] = '\0';
155
156 // Need a callback if we can't find the command.
157 if (NULL == func)
158 func = connection->unknownCommand;
159 if (func)
160 func(data, connection, SID, (char *) command, ext + 1);
161 }
162 }
163
164 // Get the next blob to check it.
165 command = eina_strbuf_string_get(connection->stream);
166 }
167
168 if (connection->_data)
169 connection->_data(data, type, ev);
170
171 return ECORE_CALLBACK_RENEW;
172}
173
174Eina_Bool parseClientStream(void *data, int type, Ecore_Con_Event_Client_Data *ev)
175{
176 // data is the server connection, but we want the client one.
177 return parseStream(ecore_con_client_data_get(ev->client), type, ev->data, ev->size, ev);
178}
179
180Eina_Bool parseServerStream(void *data, int type, Ecore_Con_Event_Server_Data *ev)
181{
182 return parseStream(data, type, ev->data, ev->size, ev);
183}
184
185
186Eina_Bool clientAdd(void *data, int type, Ecore_Con_Event_Client_Add *ev)
187{
188 Connection *conn, *connection = data;
189
190 ecore_con_client_timeout_set(ev->client, 0);
191 conn = calloc(1, sizeof(Connection));
192 conn->type = CT_CLIENT;
193 conn->conn.client.client = ev->client;
194 conn->conn.client.myServer = connection;
195 conn->name = strdup(connection->name);
196 conn->address = strdup(connection->address);
197 conn->port = connection->port;
198 conn->pointer = connection->pointer;
199 conn->commands = eina_hash_string_superfast_new(NULL);
200 ecore_con_client_data_set(ev->client, conn);
201
202 if (connection->_add)
203 return connection->_add(connection->pointer, type, ev);
204
205 return ECORE_CALLBACK_RENEW;
206}
207
208Eina_Bool clientDel(void *data, int type, Ecore_Con_Event_Client_Del *ev)
209{
210 Connection *connection = data;
211
212 if (ev->client)
213 {
214 Eina_List const *clients;
215
216 // This is only really for testing, normally it just runs 24/7, or until told not to.
217 clients = ecore_con_server_clients_get(connection->conn.server.server);
218 if (0 == eina_list_count(clients))
219 printf("No more clients, exiting.");
220 else
221 printf("Some %d more clients, exiting anyway.", eina_list_count(clients));
222
223// TODO - Probably should just keep running, both servers, and go away when all clients are gone for testing.
224
225 if (connection->_del)
226 connection->_del(connection->pointer, type, ev);
227
228 ecore_con_client_del(ev->client);
229 ecore_main_loop_quit();
230 }
231
232 return ECORE_CALLBACK_RENEW;
233}
234
235Connection *openArms(char *name, const char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del, streamParser _parser)
236{
237 Connection *conn = calloc(1, sizeof(Connection));
238 Ecore_Con_Server *server;
239
240 conn->type = CT_SERVER;
241// conn->conn.server.serverCommand = ;
242 conn->name = strdup(name);
243 conn->address = strdup(address);
244 conn->port = port;
245
246 conn->pointer = data;
247 conn->_add = _add;
248 conn->_data = _data;
249 conn->_del = _del;
250 conn->unknownCommand = _parser;
251 conn->commands = eina_hash_string_superfast_new(NULL);
252
253 if ((server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, address, port, data)))
254 {
255 conn->conn.server.server = server;
256
257 conn->add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) clientAdd, conn);
258 conn->add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) parseClientStream, conn);
259 conn->add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) clientDel, conn);
260 ecore_con_server_timeout_set(server, 0);
261 ecore_con_server_client_limit_set(server, -1, 0);
262 ecore_con_server_data_set(server, conn);
263// ecore_con_server_timeout_set(server, 10);
264// ecore_con_server_client_limit_set(server, 3, 0);
265 }
266 else
267 {
268 free(conn->address);
269 free(conn);
270 conn = NULL;
271 }
272
273 return conn;
274}
275
276Eina_Bool serverAdd(void *data, int type, Ecore_Con_Event_Server_Add *ev)
277{
278 Connection *connection = data;
279
280 connection->conn.server.hackyCount++;
281
282 // Alledgedly this checks for real conections, but given that the first time it's called, there's no real connection, this is failing somehow.
283 //if (ecore_con_server_connected_get(ev->server))
284 if (connection->conn.server.hackyCount <= 1)
285 printf("Bogus server ignored.");
286 else
287 {
288 printf("Connected to %s server.", connection->name);
289 connection->conn.server.server = ev->server;
290 // In case the server crashed, clear out any waiting data.
291 if (connection->stream)
292 eina_strbuf_reset(connection->stream);
293
294 if (connection->_add)
295 connection->_add(data, type, ev);
296 }
297
298 return ECORE_CALLBACK_RENEW;
299}
300
301Eina_Bool serverDel(void *data, int type, Ecore_Con_Event_Server_Del *ev)
302{
303 Connection *connection = data;
304
305 connection->conn.server.server = NULL;
306
307// connection->server.hackyCount--;
308 // Let it fail a couple of times during startup, then try to start our own script server.
309 connection->conn.server.count++;
310 if (1 < connection->conn.server.count)
311 {
312 char buf[PATH_MAX];
313
314 printf("Failed to connect to a %s server, starting our own.", connection->name);
315 // TODO - Should use Ecore_Exe for this sort of thing.
316 sprintf(buf, "%s/%s &", prefix_bin_get(), connection->conn.server.serverCommand);
317 system(buf);
318 connection->conn.server.count = 0;
319 // TODO - There's also the question of what to do if the connection failed.
320 // Did the server crash, or was it just the connection?
321 // Probably gonna need some smarts, for now we just restart all the scripts.
322 // Which I think gets done on server add.
323 }
324
325 if (connection->_del)
326 connection->_del(data, type, ev);
327
328
329 // TODO - May want to renew even if it's not running the GUI, but then we still need some sort of "shut down" signal, which we don't need during testing.
330// if (ourGlobals->ui)
331 return ECORE_CALLBACK_RENEW;
332
333// ecore_main_loop_quit();
334
335// return ECORE_CALLBACK_CANCEL;
336
337
338
339/* Extantz does this instead of the above returns -
340
341 if (ourGlobals->running)
342 return ECORE_CALLBACK_RENEW;
343 return ECORE_CALLBACK_CANCEL;
344*/
345}
346
347
348
349#if 1
350Ecore_Con_Server *reachOut(char *address, int port, void *data, Ecore_Event_Handler_Cb _addCb, Ecore_Event_Handler_Cb _dataCb, Ecore_Event_Handler_Cb _delCb)
351{
352 Ecore_Con_Server *server = NULL;
353 struct _conct *this = malloc(sizeof(struct _conct));
354 int count = 0;
355
356 this->address = address;
357 this->port = port;
358 this->pointer = data;
359 this->addCb = _addCb;
360 this->dataCb = _dataCb;
361 this->delCb = _delCb;
362 // This loop is overkill I think.
363 while ((!server) && (10 > count))
364 {
365 if ((server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, address, port, this->pointer)))
366 {
367 this->add = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb) _add, this);
368 this->del = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) _del, this);
369 }
370 count++;
371 }
372
373 if (!server)
374 printf("Failed to connect to server %s:%d!\n", this->address, this->port);
375
376 return server;
377}
378#else
379Connection *reachOut(char *name, char *command, char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del)
380{
381 Connection *conn = calloc(1, sizeof(Connection));
382 Ecore_Con_Server *server = NULL;
383 int count = 0;
384
385 conn->type = CT_SERVER;
386 conn->conn.server.serverCommand = strdup(command);
387 conn->name = strdup(name);
388 conn->address = strdup(address);
389 conn->port = port;
390 conn->pointer = data;
391 conn-> = _add;
392 conn-> = _data;
393 conn-> = _del;
394 conn->commands = eina_hash_string_superfast_new(NULL);
395
396 // This loop is overkill I think.
397 while ((!server) && (10 > count))
398 {
399 if ((server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, address, port, data)))
400 {
401 conn->add = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb) serverAdd, conn);
402 conn->data = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb) parseServerStream, conn);
403 conn->del = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) serverDel, conn);
404 ecore_con_server_data_set(server, conn);
405 }
406 count++;
407 }
408
409 if (!server)
410 printf("Failed to connect to the %s server %s:%d!\n", name, address, port);
411
412 return conn;
413}
414#endif
diff --git a/src/libraries/SledjHamr.h b/src/libraries/SledjHamr.h
index 07018a1..467fcc6 100644
--- a/src/libraries/SledjHamr.h
+++ b/src/libraries/SledjHamr.h
@@ -8,9 +8,56 @@
8#include <Ecore_Con.h> 8#include <Ecore_Con.h>
9 9
10 10
11typedef struct _Connection Connection;
12
13typedef Eina_Bool (* streamParser)(void *data, Connection *connection, char *SID, char *command, char *arguments);
14
15typedef enum
16{
17 CT_CLIENT,
18 CT_SERVER
19} connType;
20
21struct _ConnServer
22{
23 Ecore_Con_Server *server;
24 char *serverCommand;
25 int count, hackyCount;
26};
27
28struct _ConnClient
29{
30 Ecore_Con_Client *client;
31 Connection *myServer;
32};
33
34struct _Connection
35{
36 connType type;
37 union
38 {
39 struct _ConnServer server;
40 struct _ConnClient client;
41 } conn;
42 char *name; // For log entries and such.
43 char *address;
44 int port;
45 Eina_Strbuf *stream;
46 Eina_Hash *commands;
47// streamParser *func;
48 // Callbacks.
49 void *pointer;
50 Ecore_Event_Handler_Cb _add, _data, _del;
51 Ecore_Event_Handler *add, *data, *del;
52 streamParser unknownCommand;
53};
54
55
11Ecore_Con_Server *reachOut(char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del); 56Ecore_Con_Server *reachOut(char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del);
12void *addMessage(Eina_Clist *list, size_t size, const char *message, ...); 57void *addMessage(Eina_Clist *list, size_t size, const char *message, ...);
13void sendBack(Ecore_Con_Client *client, const char *SID, const char *message, ...); 58void sendBack(Ecore_Con_Client *client, const char *SID, const char *message, ...);
14void sendForth(Ecore_Con_Server *server, const char *SID, const char *message, ...); 59void sendForth(Ecore_Con_Server *server, const char *SID, const char *message, ...);
15 60
61Connection *openArms(char *name, const char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del, streamParser _parser);
62
16#endif 63#endif
diff --git a/src/love/love.c b/src/love/love.c
index e90278a..0465ee5 100644
--- a/src/love/love.c
+++ b/src/love/love.c
@@ -53,7 +53,6 @@ typedef struct _Lscript
53 53
54int logDom = -1; // Our logging domain. 54int logDom = -1; // Our logging domain.
55static Eina_Strbuf *LuaSLStream; 55static Eina_Strbuf *LuaSLStream;
56static Eina_Strbuf *clientStream;
57static int scriptCount = 0; 56static int scriptCount = 0;
58static int compiledCount = 0; 57static int compiledCount = 0;
59static struct timeval startTime; 58static struct timeval startTime;
@@ -507,6 +506,10 @@ static Eina_Bool _delLuaSL(void *data, int type, Ecore_Con_Event_Server_Del *ev)
507 sprintf(buf, "%s/LuaSL &", prefix_bin_get()); 506 sprintf(buf, "%s/LuaSL &", prefix_bin_get());
508 system(buf); 507 system(buf);
509 count = 0; 508 count = 0;
509 // TODO - There's also the question of what to do if the connection failed.
510 // Did the server crash, or was it just the connection?
511 // Probably gonna need some smarts, for now we just restart all the scripts.
512 // Which I think gets done on server add.
510 } 513 }
511 514
512 // TODO - May want to renew even if it's not running the GUI, but then we still need some sort of "shut down" signal, which we don't need during testing. 515 // TODO - May want to renew even if it's not running the GUI, but then we still need some sort of "shut down" signal, which we don't need during testing.
@@ -523,7 +526,6 @@ static Eina_Bool _addClient(void *data, int type, Ecore_Con_Event_Client_Add *ev
523 gameGlobals *ourGlobals = data; 526 gameGlobals *ourGlobals = data;
524 527
525 ourGlobals->client = ev->client; 528 ourGlobals->client = ev->client;
526 ecore_con_client_timeout_set(ev->client, 0);
527 529
528 if (ourGlobals->client) 530 if (ourGlobals->client)
529 { 531 {
@@ -534,91 +536,54 @@ static Eina_Bool _addClient(void *data, int type, Ecore_Con_Event_Client_Add *ev
534 return ECORE_CALLBACK_RENEW; 536 return ECORE_CALLBACK_RENEW;
535} 537}
536 538
537static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *ev) 539
540Eina_Bool clientParser(void *data, Connection *connection, char *SID, char *command, char *arguments)
538{ 541{
539 gameGlobals *ourGlobals = data; 542 gameGlobals *ourGlobals = data;
540// char buf[PATH_MAX];
541 char SID[PATH_MAX];
542 const char *command;
543 char *ext;
544 543
545 eina_strbuf_append_length(clientStream, ev->data, ev->size); 544 if (0 == strncmp(command, "events.touch_start", 18))
546 command = eina_strbuf_string_get(clientStream);
547 while ((ext = index(command, '\n')))
548 { 545 {
549 int length = ext - command; 546 Eina_Iterator *scripts;
547 LoveScript *me;
550 548
551 strncpy(SID, command, length + 1); 549 // TODO - For now, just send it to everyone.
552 SID[length] = '\0'; 550 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
553 eina_strbuf_remove(clientStream, 0, length + 1); 551 while(eina_iterator_next(scripts, (void **) &me))
554 ext = index(SID, '.');
555 if (ext)
556 { 552 {
557 ext[0] = '\0'; 553 sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedKeys({\"%s\"})", ownerKey);
558 command = ext + 1; 554 sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName);
559 555 sendForth(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)");
560 if (0 == strncmp(command, "events.touch_start(", 19))
561 {
562 Eina_Iterator *scripts;
563 LoveScript *me;
564
565 // TODO - For now, just send it to everyone.
566 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
567 while(eina_iterator_next(scripts, (void **) &me))
568 {
569 sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedKeys({\"%s\"})", ownerKey);
570 sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName);
571 sendForth(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)");
572 }
573 eina_iterator_free(scripts);
574 }
575 else if (0 == strncmp(command, "events.listen(", 14))
576 {
577 Eina_Iterator *scripts;
578 LoveScript *me;
579
580 // TODO - For now, just send it to everyone.
581 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
582 while(eina_iterator_next(scripts, (void **) &me))
583 {
584 sendForth(ourGlobals->serverLuaSL, me->SID, command);
585 }
586 eina_iterator_free(scripts);
587 }
588 else
589 PW("Unknown command from client - %s", command);
590 } 556 }
591 557 eina_iterator_free(scripts);
592 // Get the next blob to check it.
593 command = eina_strbuf_string_get(clientStream);
594 } 558 }
559 else if (0 == strncmp(command, "events.listen", 13))
560 {
561 Eina_Iterator *scripts;
562 LoveScript *me;
563 char buf[PATH_MAX];
564
565 // TODO - For now, just send it to everyone.
566 sprintf(buf, "%s(%s", command, arguments);
567 scripts = eina_hash_iterator_data_new(ourGlobals->scripts);
568 while(eina_iterator_next(scripts, (void **) &me))
569 {
570 sendForth(ourGlobals->serverLuaSL, me->SID, buf);
571 }
572 eina_iterator_free(scripts);
573 }
574 else
575 PW("Unknown command from client - %s(%s", command, arguments);
595 576
596 return ECORE_CALLBACK_RENEW; 577 return ECORE_CALLBACK_RENEW;
597} 578}
598 579
599static Eina_Bool _delClient(void *data, int type, Ecore_Con_Event_Client_Del *ev) 580static Eina_Bool _delClient(void *data, int type, Ecore_Con_Event_Client_Del *ev)
600{ 581{
601 gameGlobals *ourGlobals = data; 582 gameGlobals *ourGlobals = data;
602 583
603 if (ev->client) 584// TODO - I could coax this into something generic, maybe.
604 { 585 sendForth(ourGlobals->serverLuaSL, ownerKey, "exit()");
605 Eina_List const *clients; 586
606
607 // This is only really for testing, normally it just runs 24/7, or until told not to.
608 clients = ecore_con_server_clients_get(ourGlobals->server);
609 if (0 == eina_list_count(clients))
610 {
611 PD("No more clients, exiting.");
612 sendForth(ourGlobals->serverLuaSL, ownerKey, "exit()");
613 ecore_main_loop_quit();
614 }
615 else
616 {
617 PD("Some %d more clients, exiting anyway.", eina_list_count(clients));
618 sendForth(ourGlobals->serverLuaSL, ownerKey, "exit()");
619 ecore_main_loop_quit();
620 }
621 }
622 return ECORE_CALLBACK_RENEW; 587 return ECORE_CALLBACK_RENEW;
623} 588}
624 589
@@ -641,18 +606,10 @@ int main(int argc, char **argv)
641 if (ecore_con_init()) 606 if (ecore_con_init())
642 { 607 {
643 LuaSLStream = eina_strbuf_new(); 608 LuaSLStream = eina_strbuf_new();
644 clientStream = eina_strbuf_new();
645 reachOut("127.0.0.1", 8211, &ourGlobals, (Ecore_Event_Handler_Cb) _addLuaSL, (Ecore_Event_Handler_Cb) _dataLuaSL, (Ecore_Event_Handler_Cb) _delLuaSL); 609 reachOut("127.0.0.1", 8211, &ourGlobals, (Ecore_Event_Handler_Cb) _addLuaSL, (Ecore_Event_Handler_Cb) _dataLuaSL, (Ecore_Event_Handler_Cb) _delLuaSL);
646 610
647 if ((ourGlobals.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, ourGlobals.address, ourGlobals.port + 1, &ourGlobals))) 611 if (openArms("love", ourGlobals.address, ourGlobals.port + 1, &ourGlobals, (Ecore_Event_Handler_Cb) _addClient, NULL, (Ecore_Event_Handler_Cb) _delClient, clientParser))
648 { 612 {
649 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _addClient, &ourGlobals);
650 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _dataClient, &ourGlobals);
651 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _delClient, &ourGlobals);
652 ecore_con_server_timeout_set(ourGlobals.server, 0);
653 ecore_con_server_client_limit_set(ourGlobals.server, -1, 0);
654
655
656 if (ecore_evas_init()) 613 if (ecore_evas_init())
657 { 614 {
658 if (edje_init()) 615 if (edje_init())