aboutsummaryrefslogtreecommitdiffstats
path: root/main/opennhrp/0007-fix-race-condition-to-stop-processing-dns-requests.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-07-24 16:09:30 +0300
committerTimo Teräs <timo.teras@iki.fi>2015-07-24 16:09:30 +0300
commit0df48acd155da7f5a1a6ed28ffa0c3d3624084a5 (patch)
tree5b9f28fb5973a49b7e8b8faada465ccf96644548 /main/opennhrp/0007-fix-race-condition-to-stop-processing-dns-requests.patch
parentdf1c822e76d712cb306e491fd652b5acb54acaa0 (diff)
downloadaports-0df48acd155da7f5a1a6ed28ffa0c3d3624084a5.tar.bz2
aports-0df48acd155da7f5a1a6ed28ffa0c3d3624084a5.tar.xz
main/opennhrp: cherry-pick upstream fixes
Diffstat (limited to 'main/opennhrp/0007-fix-race-condition-to-stop-processing-dns-requests.patch')
-rw-r--r--main/opennhrp/0007-fix-race-condition-to-stop-processing-dns-requests.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/main/opennhrp/0007-fix-race-condition-to-stop-processing-dns-requests.patch b/main/opennhrp/0007-fix-race-condition-to-stop-processing-dns-requests.patch
new file mode 100644
index 0000000000..b25c53a68d
--- /dev/null
+++ b/main/opennhrp/0007-fix-race-condition-to-stop-processing-dns-requests.patch
@@ -0,0 +1,35 @@
+From 8be8f8df88490f6d9686fcbf2cd50a5b15e2c835 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Fri, 24 Jul 2015 10:34:13 +0300
+Subject: [PATCH] fix race condition to stop processing dns requests
+
+ev_timer_again stops the timer if .repeat is zero, but ares_timeout
+returns zero timeout if there's events that are already expired.
+This becomes issue if we were busy processing something else and
+then c-ares timeouts expire meanwhile, we'd end up not handling them.
+As a workaround schedule it with small timeout, while this can
+postpone timeout handling quite a bit, in practice this should
+work well enough.
+---
+ nhrp/nhrp_address.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/nhrp/nhrp_address.c b/nhrp/nhrp_address.c
+index 1ac9fa3..9169cd8 100644
+--- a/nhrp/nhrp_address.c
++++ b/nhrp/nhrp_address.c
+@@ -47,7 +47,10 @@ static void ares_prepare_cb(struct ev_loop *loop, struct ev_prepare *w, int reve
+
+ tv = ares_timeout(r->channel, NULL, &tvbuf);
+ if (tv != NULL) {
+- r->timeout.repeat = tv->tv_sec + tv->tv_usec * 1e-6;
++ if (tv->tv_sec || tv->tv_usec)
++ r->timeout.repeat = tv->tv_sec + tv->tv_usec * 1e-6;
++ else
++ r->timeout.repeat = 1e-6;
+ ev_timer_again(&r->timeout);
+ } else {
+ ev_timer_stop(&r->timeout);
+--
+2.4.6
+