aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2011-07-14 12:12:01 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-07-19 20:07:20 +0200
commit8d9876e1ba158a569d543b08d122016f19e76108 (patch)
tree3e7a791bb97405c21037fc52a135a7df8bd63c5e
parent3118191f59c066ec47e5e34c5ce28677b4351399 (diff)
osmo-bsc: Only keep the newest of subsequent invalid positions
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c
index 69622bbe8..7d376ef0e 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_main.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c
@@ -185,7 +185,7 @@ static LLIST_HEAD(locations);
void cleanup_locations()
{
struct location *myloc, *tmp;
- int i = 0;
+ int invalpos = 0, i = 0;
LOGP(DCTRL, LOGL_DEBUG, "Checking position list.\n");
llist_for_each_entry_safe(myloc, tmp, &locations, list) {
@@ -194,6 +194,17 @@ void cleanup_locations()
LOGP(DCTRL, LOGL_DEBUG, "Deleting old position.\n");
llist_del(&myloc->list);
talloc_free(myloc);
+ } else if (!myloc->valid) { /* Only capture the newest of subsequent invalid positions */
+ invalpos++;
+ if (invalpos > 1) {
+ LOGP(DCTRL, LOGL_DEBUG, "Deleting subsequent invalid position.\n");
+ invalpos--;
+ i--;
+ llist_del(&myloc->list);
+ talloc_free(myloc);
+ }
+ } else {
+ invalpos = 0;
}
}
LOGP(DCTRL, LOGL_DEBUG, "Found %i positions.\n", i);