summaryrefslogtreecommitdiff
blob: 5e666af21ec8abf5c063eabea8158917735aac1b (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
diff -Naur GNUnet-0.7.0d.orig/src/transports/udp.c GNUnet-0.7.0d/src/transports/udp.c
--- GNUnet-0.7.0d.orig/src/transports/udp.c	2006-03-12 01:04:29.000000000 -0600
+++ GNUnet-0.7.0d/src/transports/udp.c	2006-05-13 23:17:45.000000000 -0500
@@ -247,7 +247,21 @@
     }
     if (pending <= 0) {
       LOG(LOG_WARNING,
-	  _("UDP: select returned, but ioctl reports 0 bytes available!\n"));
+	  _("UDP: select returned, but ioctl reports %d bytes available!\n"),
+	  pending);
+      if (pending == 0) {
+      	/* maybe empty UDP packet was sent (see report on bug-gnunet,
+	   5/11/6; read 0 bytes from UDP just to kill potential empty packet! */
+	memset(&incoming,
+	       0, 
+	       sizeof(struct sockaddr_in));
+	RECVFROM(udp_sock,
+		 NULL,
+		 0,
+		 0,
+		 (struct sockaddr * )&incoming,
+		 &addrlen);	
+      }
       continue;
     }   
     if (pending >= 65536) {
diff -Naur GNUnet-0.7.0d.orig/src/transports/udp6.c GNUnet-0.7.0d/src/transports/udp6.c
--- GNUnet-0.7.0d.orig/src/transports/udp6.c	2006-03-11 15:32:00.000000000 -0600
+++ GNUnet-0.7.0d/src/transports/udp6.c	2006-05-13 23:17:45.000000000 -0500
@@ -230,6 +230,25 @@
       LOG_STRERROR(LOG_ERROR, "ioctl");
       continue;
     }
+    if (pending <= 0) {
+      LOG(LOG_WARNING,
+	  _("UDP6: select returned, but ioctl reports %d bytes available!\n"),
+	  pending);
+      if (pending == 0) {
+      	/* maybe empty UDP packet was sent (see report on bug-gnunet,
+	   5/11/6; read 0 bytes from UDP just to kill potential empty packet! */
+	memset(&incoming,
+	       0, 
+	       sizeof(struct sockaddr_in6));
+	RECVFROM(udp6_sock,
+		 NULL,
+		 0,
+		 0,
+		 (struct sockaddr * )&incoming,
+		 &addrlen);	
+      }
+      continue;
+    }   
     if (pending >= 65536) {
       BREAK();
       continue;