remove the need for C99 math (closes: #1579)
[openwrt/svn-archive/archive.git] / net / olsrd / patches / 250-olsrd-cpu-overload.patch
1 diff -Nur olsrd-0.4.10.orig/src/parser.c olsrd-0.4.10/src/parser.c
2 --- olsrd-0.4.10.orig/src/parser.c 2005-11-19 09:49:44.000000000 +0100
3 +++ olsrd-0.4.10/src/parser.c 2006-12-04 09:12:40.000000000 +0100
4 @@ -61,6 +61,14 @@
5 #define strerror(x) StrError(x)
6 #endif
7
8 +/* Sven-Ola: On very slow devices used in huge networks
9 + * the amount of lq_tc messages is so high, that the
10 + * recv() loop never ends. This is a small hack to end
11 + * the loop in this cases
12 + */
13 +
14 +unsigned int cpu_overload_exit = 0;
15 +
16 struct parse_function_entry *parse_functions;
17
18 static char inbuf[MAXMESSAGESIZE+1];
19 @@ -347,9 +355,16 @@
20 int cc;
21 struct interface *olsr_in_if;
22 union olsr_ip_addr from_addr;
23 -
24 + cpu_overload_exit = 0;
25 +
26 for (;;)
27 {
28 + if (32 < ++cpu_overload_exit)
29 + {
30 + OLSR_PRINTF(1, "CPU overload detected, ending olsr_input() loop\n")
31 + break;
32 + }
33 +
34 fromlen = sizeof(struct sockaddr_storage);
35
36 cc = olsr_recvfrom(fd,