aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-06-27 23:51:02 +0200
committerHarald Welte <laforge@gnumonks.org>2011-06-27 23:51:02 +0200
commitd04d43098dd9017517e149016d3bcbcf4906c50c (patch)
tree1a0aa9d744d68eb629838c4fb99d08475e9ad4ee
parent656c8236a5ccf3f8dfb77785b9e4a8735404031e (diff)
paging: add paging_reset() function
-rw-r--r--include/osmo-bts/paging.h2
-rw-r--r--src/common/paging.c20
2 files changed, 22 insertions, 0 deletions
diff --git a/include/osmo-bts/paging.h b/include/osmo-bts/paging.h
index 793a2a1..a795188 100644
--- a/include/osmo-bts/paging.h
+++ b/include/osmo-bts/paging.h
@@ -11,6 +11,8 @@ struct paging_state;
struct paging_state *paging_init(void *ctx, unsigned int num_paging_max,
unsigned int paging_lifetime);
+void paging_reset(struct paging_state *ps);
+
/* update with new SYSTEM INFORMATION parameters */
int paging_si_update(struct paging_state *ps, struct gsm48_control_channel_descr *chan_desc);
diff --git a/src/common/paging.c b/src/common/paging.c
index 0f51d75..6276b1d 100644
--- a/src/common/paging.c
+++ b/src/common/paging.c
@@ -438,3 +438,23 @@ struct paging_state *paging_init(void *ctx, unsigned int num_paging_max,
}
return ps;
}
+
+void paging_reset(struct paging_state *ps)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(ps->paging_queue); i++) {
+ struct llist_head *queue = &ps->paging_queue[i];
+ struct paging_record *pr, *pr2;
+ llist_for_each_entry_safe(pr, pr2, queue, list) {
+ llist_del(&pr->list);
+ talloc_free(pr);
+ ps->num_paging--;
+ }
+ }
+
+ if (ps->num_paging != 0)
+ LOGP(DPAG, LOGL_NOTICE, "num_paging != 0 after flushing all records?!?\n");
+
+ ps->num_paging = 0;
+}