path: root/openbsc/src
diff options
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-12-03 11:08:23 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-09 09:08:28 +0100
commit70d8e31a748026a92e5739147411dcf512df7205 (patch)
tree3cafaaf35fc462b7c72f0e591624f941fef567a5 /openbsc/src
parent901c40f55041d72220403c653646a2e8f82f1924 (diff)
msc: Add per subscriber keep_in_ram flag
Currently the keep_subscr flag in gsm_subscriber_group refers to a whole group of subscribers which makes it difficult to really delete single entries if the flag is set. This patch adds a keep_in_ram field to gsm_subscriber which allows for keeping subscriber objects in RAM while deleting others. Note that really deleting an entry requires that both flags (subscr_group->keep_subscr and subscr->keep_in_ram) are set to 0. So only the latter should be used if a specification requires the deletion of a subscriber entry. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src')
1 files changed, 3 insertions, 1 deletions
diff --git a/openbsc/src/libcommon/gsm_subscriber_base.c b/openbsc/src/libcommon/gsm_subscriber_base.c
index 3d01ca20d..3c56101f6 100644
--- a/openbsc/src/libcommon/gsm_subscriber_base.c
+++ b/openbsc/src/libcommon/gsm_subscriber_base.c
@@ -91,7 +91,9 @@ struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr)
DEBUGP(DREF, "subscr %s usage decreased usage to: %d\n",
subscr->extension, subscr->use_count);
- if (subscr->use_count <= 0 && !subscr->group->keep_subscr)
+ if (subscr->use_count <= 0 &&
+ !((subscr->group && subscr->group->keep_subscr) ||
+ subscr->keep_in_ram))
return NULL;