summaryrefslogtreecommitdiff
path: root/www/drivel/patches/patch-ab
blob: 4ebb0a86e6ffb5bdd7825f0921b4a78226a1d844 (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
$NetBSD: patch-ab,v 1.1.1.1 2004/06/22 21:31:08 jmmv Exp $

--- src/network.c.orig	2004-06-22 22:36:40.000000000 +0200
+++ src/network.c
@@ -35,6 +35,7 @@
 #define BUFFER_SIZE 1
 
 extern GMutex *network_mutex;
+gint network_busy = 0;
 gchar *post_data = NULL;
 gint dialog_count = 0;
 DrivelRequestType global_type;
@@ -310,7 +311,15 @@ send_get_request (gpointer data)
 	
 	ThreadData *td;
 	
-	g_mutex_lock (network_mutex);
+	for (;;) {
+		g_mutex_lock (network_mutex);
+		if (!network_busy) {
+			network_busy = 1;
+			g_mutex_unlock (network_mutex);
+			break;
+		}
+		g_mutex_unlock (network_mutex);
+	}
 	
 	td = (ThreadData *)data;
 	
@@ -397,7 +406,15 @@ send_request (gpointer data)
 	glong http_code;
 	ThreadData *td;
 	
-	g_mutex_lock (network_mutex);
+	for (;;) {
+		g_mutex_lock (network_mutex);
+		if (!network_busy) {
+			network_busy = 1;
+			g_mutex_unlock (network_mutex);
+			break;
+		}
+		g_mutex_unlock (network_mutex);
+	}
 	
 	td = (ThreadData *) data;
 	
@@ -522,6 +539,8 @@ lj_network_loop (gpointer data)
 		
 		dialog_close (dc);
 		
+		g_mutex_lock (network_mutex);
+		network_busy = 0;
 		g_mutex_unlock (network_mutex);
 		
 		g_free (queue_data);