summaryrefslogtreecommitdiff
blob: 3375bd5f418b1d2075bf1e6cd37c5f50dd68d49a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- 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