* [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid rounding issues for local hna timeout
@ 2010-06-19 15:24 Linus Lüssing
2010-06-19 22:23 ` Simon Wunderlich
0 siblings, 1 reply; 2+ messages in thread
From: Linus Lüssing @ 2010-06-19 15:24 UTC (permalink / raw)
To: b.a.t.m.a.n
With the current default values, this patch is not critical, as
LOCAL_HNA_TIMEOUT is a multiple of 1000 anyway. However, if someone
would like to change this #define, the person could have some
unexpected rounding issues. Therefore doing the multiplication before
the division now.
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
translation-table.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/translation-table.c b/translation-table.c
index 619a9a8..cf37cc4 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -259,7 +259,7 @@ static void hna_local_purge(struct work_struct *work)
hna_local_entry = hashit.bucket->data;
timeout = hna_local_entry->last_seen +
- ((LOCAL_HNA_TIMEOUT / 1000) * HZ);
+ ((LOCAL_HNA_TIMEOUT * HZ) / 1000);
if ((!hna_local_entry->never_purge) &&
time_after(jiffies, timeout))
hna_local_del(hna_local_entry, "address timed out");
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid rounding issues for local hna timeout
2010-06-19 15:24 [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid rounding issues for local hna timeout Linus Lüssing
@ 2010-06-19 22:23 ` Simon Wunderlich
0 siblings, 0 replies; 2+ messages in thread
From: Simon Wunderlich @ 2010-06-19 22:23 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]
Hey Linus,
thanks, applied in r1710.
Cheers,
Simon
On Sat, Jun 19, 2010 at 05:24:34PM +0200, Linus Lüssing wrote:
> With the current default values, this patch is not critical, as
> LOCAL_HNA_TIMEOUT is a multiple of 1000 anyway. However, if someone
> would like to change this #define, the person could have some
> unexpected rounding issues. Therefore doing the multiplication before
> the division now.
>
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> ---
> translation-table.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/translation-table.c b/translation-table.c
> index 619a9a8..cf37cc4 100644
> --- a/translation-table.c
> +++ b/translation-table.c
> @@ -259,7 +259,7 @@ static void hna_local_purge(struct work_struct *work)
> hna_local_entry = hashit.bucket->data;
>
> timeout = hna_local_entry->last_seen +
> - ((LOCAL_HNA_TIMEOUT / 1000) * HZ);
> + ((LOCAL_HNA_TIMEOUT * HZ) / 1000);
> if ((!hna_local_entry->never_purge) &&
> time_after(jiffies, timeout))
> hna_local_del(hna_local_entry, "address timed out");
> --
> 1.7.1
>
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-06-19 22:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-19 15:24 [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid rounding issues for local hna timeout Linus Lüssing
2010-06-19 22:23 ` Simon Wunderlich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).