aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gsm_04_08.c
diff options
context:
space:
mode:
authorJan Luebbe <jluebbe@debian.org>2009-08-12 10:19:34 +0200
committerHarald Welte <laforge@gnumonks.org>2009-08-12 21:04:33 +0200
commit370b41d7f1a6fc93c691f94ec9d920d1b55682ac (patch)
treed2514e72effc35c4d7c6aa18b09eddce47acbbdf /openbsc/src/gsm_04_08.c
parentb0dfc31d7dc7ed533d5802b51dfb4cee92328d5c (diff)
look up subscriber in memory before loading from DB
Diffstat (limited to 'openbsc/src/gsm_04_08.c')
-rw-r--r--openbsc/src/gsm_04_08.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 5c4465e37..0523538a8 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -1151,6 +1151,10 @@ static int mm_rx_id_resp(struct msgb *msg)
switch (mi_type) {
case GSM_MI_TYPE_IMSI:
+ /* look up subscriber based on IMSI, create if not found */
+ if (!lchan->subscr) {
+ lchan->subscr = subscr_get_by_imsi(net, mi_string);
+ }
if (!lchan->subscr) {
lchan->subscr = db_create_subscriber(net, mi_string);
if (lchan->subscr->flags & GSM_SUBSCRIBER_FIRST_CONTACT) {
@@ -1247,8 +1251,11 @@ static int mm_rx_loc_upd_req(struct msgb *msg)
rc = mm_tx_identity_req(lchan, GSM_MI_TYPE_IMEI);
lchan->loc_operation->waiting_for_imei = 1;
- /* look up subscriber based on IMSI */
- subscr = db_create_subscriber(bts->network, mi_string);
+ /* look up subscriber based on IMSI, create if not found */
+ subscr = subscr_get_by_imsi(bts->network, mi_string);
+ if (!subscr) {
+ subscr = db_create_subscriber(bts->network, mi_string);
+ }
if (subscr->flags & GSM_SUBSCRIBER_FIRST_CONTACT) {
dispatch_signal(SS_SUBSCR, S_SUBSCR_FIRST_CONTACT, &subscr);
}