From 8d9876e1ba158a569d543b08d122016f19e76108 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Thu, 14 Jul 2011 12:12:01 +0200 Subject: osmo-bsc: Only keep the newest of subsequent invalid positions --- openbsc/src/osmo-bsc/osmo_bsc_main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'openbsc/src/osmo-bsc/osmo_bsc_main.c') 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); -- cgit v1.2.3