Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > a7566b13192fa881d4a65fa4250d3d54 > files > 11

gamin-0.1.7-10.el5.src.rpm

--- gamin-0.1.7/server/gam_eq.c.timer-on-demand	2005-08-05 11:57:48.000000000 +0200
+++ gamin-0.1.7/server/gam_eq.c	2006-09-05 10:57:06.000000000 +0200
@@ -119,9 +119,10 @@
 	gam_eq_event_free (event);
 }
 
-void
+gboolean
 gam_eq_flush (gam_eq_t *eq, GamConnDataPtr conn)
 {
+	gboolean done_work = FALSE;
 	if (!eq)
 		return;
 
@@ -130,8 +131,10 @@
 #endif
 	while (!g_queue_is_empty (eq->event_queue))
 	{
+		done_work = TRUE;
 		gam_eq_event_t *event = g_queue_pop_head (eq->event_queue);
 		g_assert (event);
 		gam_eq_flush_callback (eq, event, conn);
 	}
+	return done_work;
 }
--- gamin-0.1.7/server/gam_connection.c.timer-on-demand	2005-09-22 10:10:55.000000000 +0200
+++ gamin-0.1.7/server/gam_connection.c	2006-09-05 10:57:06.000000000 +0200
@@ -159,12 +159,15 @@
 static gboolean
 gam_connection_eq_flush (gpointer data)
 {
+	gboolean work;
 	GamConnDataPtr conn = (GamConnDataPtr)data;
 	if (!conn)
 		return FALSE;
 
-	gam_eq_flush (conn->eq, conn);
-	return TRUE;
+	work = gam_eq_flush (conn->eq, conn);
+	if (!work)
+		conn->eq_source = 0;
+	return work;
 }
 
 /**
@@ -193,7 +196,7 @@
     ret->loop = loop;
     ret->source = source;
     ret->eq = gam_eq_new ();
-    ret->eq_source = g_timeout_add (100 /* ms */, gam_connection_eq_flush, ret);
+    ret->eq_source = g_timeout_add (100 /* 100 milisecond */, gam_connection_eq_flush, ret);
     gamConnList = g_list_prepend(gamConnList, ret);
 
     GAM_DEBUG(DEBUG_INFO, "Created connection %d\n", ret->fd);
@@ -620,6 +623,8 @@
 	g_assert (conn->eq);
 
 	gam_eq_queue (conn->eq, reqno, event, path, len);
+	if (!conn->eq_source)
+	    conn->eq_source = g_timeout_add (100 /* 100 milisecond */, gam_connection_eq_flush, conn);
 }
 
 
--- gamin-0.1.7/server/gam_eq.h.timer-on-demand	2006-09-05 11:00:12.000000000 +0200
+++ gamin-0.1.7/server/gam_eq.h	2006-09-05 11:00:46.000000000 +0200
@@ -9,6 +9,6 @@
 void			gam_eq_free	(gam_eq_t *eq);
 void			gam_eq_queue	(gam_eq_t *eq, int reqno, int event, const char *path, int len); 
 guint			gam_eq_size	(gam_eq_t *eq);
-void			gam_eq_flush	(gam_eq_t *eq, GamConnDataPtr conn);
+gboolean		gam_eq_flush	(gam_eq_t *eq, GamConnDataPtr conn);
 
 #endif