aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/LuaSL
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-14 09:02:51 +1000
committerDavid Walter Seikel2014-05-14 09:02:51 +1000
commit8dc65d54d2c422690852b8bc7d0b7d35ca4582bc (patch)
tree7cd389f3139cb129f45003e88a172c6804d031ec /src/LuaSL
parentPurkle gets an append command, and use it from extantz to show llSay() and fr... (diff)
downloadSledjHamr-8dc65d54d2c422690852b8bc7d0b7d35ca4582bc.zip
SledjHamr-8dc65d54d2c422690852b8bc7d0b7d35ca4582bc.tar.gz
SledjHamr-8dc65d54d2c422690852b8bc7d0b7d35ca4582bc.tar.bz2
SledjHamr-8dc65d54d2c422690852b8bc7d0b7d35ca4582bc.tar.xz
Starting up and closing down the servers gets some love. Needs more love.
Diffstat (limited to 'src/LuaSL')
-rw-r--r--src/LuaSL/LuaSL_main.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c
index f02c5bf..bfa8728 100644
--- a/src/LuaSL/LuaSL_main.c
+++ b/src/LuaSL/LuaSL_main.c
@@ -255,14 +255,16 @@ int main(int argc, char **argv)
255 if ((ourGlobals.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, ourGlobals.address, ourGlobals.port, &ourGlobals))) 255 if ((ourGlobals.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, ourGlobals.address, ourGlobals.port, &ourGlobals)))
256 { 256 {
257 int i; 257 int i;
258 Eina_Iterator *scripts;
259 script *me;
258 260
259 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &ourGlobals); 261 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &ourGlobals);
260 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &ourGlobals); 262 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &ourGlobals);
261 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &ourGlobals); 263 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &ourGlobals);
262 ecore_con_server_timeout_set(ourGlobals.server, 0); 264 ecore_con_server_timeout_set(ourGlobals.server, 0);
263 ecore_con_server_client_limit_set(ourGlobals.server, -1, 0); 265 ecore_con_server_client_limit_set(ourGlobals.server, -1, 0);
264 ecore_con_server_timeout_set(ourGlobals.server, 10); 266// ecore_con_server_timeout_set(ourGlobals.server, 10);
265 ecore_con_server_client_limit_set(ourGlobals.server, 3, 0); 267// ecore_con_server_client_limit_set(ourGlobals.server, 3, 0);
266 clientStream = eina_strbuf_new(); 268 clientStream = eina_strbuf_new();
267 269
268 result = 0; 270 result = 0;
@@ -274,8 +276,21 @@ int main(int argc, char **argv)
274 PE("Error creating luaproc worker thread."); 276 PE("Error creating luaproc worker thread.");
275 } 277 }
276 ecore_main_loop_begin(); 278 ecore_main_loop_begin();
279 PD("Fell out of the main loop.");
277 280
278 // TODO - this is what hangs the system, should change from raw pthreads to ecore threads. 281 scripts = eina_hash_iterator_data_new(ourGlobals.scripts);
282 while(eina_iterator_next(scripts, (void **) &me))
283 {
284 const char *status = NULL;
285
286 status = sendToChannel(&ourGlobals, me->SID, "quit()");
287 if (status)
288 PE("Error sending command quit() to script %s : %s", me->SID, status);
289 }
290
291 PD("Finished quitting scripts.");
292 // TODO - This is what hangs the system, should change from raw pthreads to ecore threads.
293 // Or perhaps just run the main loop for a bit longer so all the scripts can quit?
279 sched_join_workerthreads(); 294 sched_join_workerthreads();
280 } 295 }
281 else 296 else
@@ -292,6 +307,7 @@ int main(int argc, char **argv)
292 else 307 else
293 fprintf(stderr, "Failed to init eina!"); 308 fprintf(stderr, "Failed to init eina!");
294 309
310 PD("Falling out of main()");
295 return result; 311 return result;
296} 312}
297 313