Enlightenment CVS committal
Author : chaos
Project : e17
Module : libs/epsilon
Dir : e17/libs/epsilon/src/bin
Modified Files:
epsilon_thumbd.c
Log Message:
* Experimental fix to recent epsilon issues. We now start/pull down the
'worker listener' ecore_con in response to the number of children we're waiting
to finish. This stops the connection mysteriously disappearing.
===================================================================
RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_thumbd.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- epsilon_thumbd.c 3 Jun 2006 11:19:59 -0000 1.2
+++ epsilon_thumbd.c 1 Jul 2007 00:05:19 -0000 1.3
@@ -76,8 +76,9 @@
};
static int client_id = 1;
-static int debug = 0;
+static int debug = 1;
static double idle_time = 0;
+static int running_workers = 0;
static int worker_limit = EPSILON_WORKERS;
@@ -90,6 +91,7 @@
static Ecore_Event_Handler *worker_data = NULL;
static Ecore_List *queued_workers;
+static Ecore_List *gworkers = NULL;
static Ecore_Con_Server *thumb_server = NULL;
static Ecore_Con_Server *thumbd_server = NULL;
@@ -101,6 +103,49 @@
static int epsilond_client_clean(Epsilon_Client *cl);
static int epsilond_worker_clean(Epsilon_Worker *worker);
+int epsilond_cb_worker_add(void *data, int type, void *event);
+int epsilond_cb_worker_del(void *data, int type, void *event);
+int epsilond_cb_worker_data(void *data, int type, void *event);
+
+
+void epsilond_init_thumbd_server(Ecore_List* workers)
+{
+ char* buf;
+
+ /*
+ * Retrieve the safe socket name for the server.
+ */
+ buf = epsilond_socket_path(EPSILOND_SOCK);
+
+ if (debug) printf("socket name %s\n", buf);
+
+ /*
+ * Setup the IPC server to handle completed notifications
+ */
+ thumbd_server = ecore_con_server_add(ECORE_CON_LOCAL_USER, buf, 0,
NULL);
+
+ free(buf);
+
+ /*
+ * Prepare the handlers for worker IPC events
+ */
+ worker_add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD,
epsilond_cb_worker_add, workers);
+ worker_del = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL,
epsilond_cb_worker_del, workers);
+ worker_data = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA,
epsilond_cb_worker_data, workers);
+}
+
+void epsilond_shutdown_thumbd_server()
+{
+ if (thumbd_server)
+ ecore_con_server_del(thumbd_server);
+
+ ecore_event_handler_del(worker_add);
+ ecore_event_handler_del(worker_del);
+ ecore_event_handler_del(worker_data);
+}
+
+
+
/*
* Handle a client connect and add the new client to the list of clients.
*/
@@ -196,6 +241,9 @@
ecore_list_next(clients);
}
+ running_workers--;
+ if (!running_workers) epsilond_shutdown_thumbd_server();
+
return 1;
}
@@ -633,6 +681,10 @@
if (!worker->child) {
if (ecore_list_nodes(worker->thumbs)) {
idle--;
+
+ if (!running_workers)
epsilond_init_thumbd_server(gworkers);
+ running_workers++;
+
if (!epsilond_worker_fork(worker))
return 0;
}
@@ -664,7 +716,6 @@
int wi;
char *buf;
Ecore_List *clients = NULL;
- Ecore_List *workers = NULL;
epsilon_init();
@@ -672,7 +723,7 @@
* Create the accounting data for the clients and thumbnail queue.
*/
clients = ecore_list_new();
- workers = ecore_list_new();
+ gworkers = ecore_list_new();
response_queue = ecore_list_new();
queued_workers = ecore_list_new();
@@ -696,27 +747,6 @@
client_add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD,
epsilond_cb_client_add, clients);
client_del = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL,
epsilond_cb_client_del, clients);
client_data = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA,
epsilond_cb_client_data, clients);
-
- /*
- * Retrieve the safe socket name for the server.
- */
- buf = epsilond_socket_path(EPSILOND_SOCK);
-
- if (debug) printf("socket name %s\n", buf);
-
- /*
- * Setup the IPC server to handle completed notifications
- */
- thumbd_server = ecore_con_server_add(ECORE_CON_LOCAL_USER, buf, 0,
NULL);
-
- free(buf);
-
- /*
- * Prepare the handlers for worker IPC events
- */
- worker_add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD,
epsilond_cb_worker_add, workers);
- worker_del = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL,
epsilond_cb_worker_del, workers);
- worker_data = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA,
epsilond_cb_worker_data, workers);
/*
* Initialize the worker threads
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs