From 024dc77de23bdc31f9592d1768cdd285c0dbb7bf Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 24 Feb 2014 14:29:27 +0100 Subject: sms: Do not interfere with the SMS queue from within gsm_04_11 It was possible that two SMS would be delivered at the same time which violates GSM 04.11. We should solely rely on the sms queue to schedule more SMS to the subscriber. --- openbsc/src/libmsc/gsm_04_11.c | 11 ----------- openbsc/src/libmsc/sms_queue.c | 12 ++++++------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c index 45e5dc5e9..975a263ae 100644 --- a/openbsc/src/libmsc/gsm_04_11.c +++ b/openbsc/src/libmsc/gsm_04_11.c @@ -561,11 +561,6 @@ static int gsm411_rx_rp_ack(struct msgb *msg, struct gsm_trans *trans, sms_free(sms); trans->sms.sms = NULL; - /* check for more messages for this subscriber */ - sms = db_sms_get_unsent_for_subscr(trans->subscr); - if (sms) - gsm411_send_sms(trans->conn, sms); - return 0; } @@ -615,7 +610,6 @@ static int gsm411_rx_rp_error(struct msgb *msg, struct gsm_trans *trans, static int gsm411_rx_rp_smma(struct msgb *msg, struct gsm_trans *trans, struct gsm411_rp_hdr *rph) { - struct gsm_sms *sms; int rc; rc = gsm411_send_rp_ack(trans, rph->msg_ref); @@ -625,11 +619,6 @@ static int gsm411_rx_rp_smma(struct msgb *msg, struct gsm_trans *trans, * transfer those */ send_signal(S_SMS_SMMA, trans, NULL, 0); - /* check for more messages for this subscriber */ - sms = db_sms_get_unsent_for_subscr(trans->subscr); - if (sms) - gsm411_send_sms(trans->conn, sms); - return rc; } diff --git a/openbsc/src/libmsc/sms_queue.c b/openbsc/src/libmsc/sms_queue.c index c8745c3da..b7753270a 100644 --- a/openbsc/src/libmsc/sms_queue.c +++ b/openbsc/src/libmsc/sms_queue.c @@ -380,6 +380,7 @@ static int sms_sms_cb(unsigned int subsys, unsigned int signal, /* We got a new SMS and maybe should launch the queue again. */ if (signal == S_SMS_SUBMITTED || signal == S_SMS_SMMA) { + /* TODO: For SMMA we might want to re-use the radio connection. */ sms_queue_trigger(network->sms_queue); return 0; } @@ -399,15 +400,14 @@ static int sms_sms_cb(unsigned int subsys, unsigned int signal, switch (signal) { case S_SMS_DELIVERED: + network->sms_queue->pending -= 1; + sms_pending_free(pending); /* - * Create place for a new SMS but keep the pending data - * so we will not attempt to send the SMS for this subscriber - * as we still have an open channel and will attempt to submit - * SMS to it anyway. + * TODO: we could specially make sure to re-use the existing + * radio connection here. Maybe something like the readyForSM + * code. */ - network->sms_queue->pending -= 1; sms_submit_pending(network->sms_queue); - sms_pending_free(pending); break; case S_SMS_MEM_EXCEEDED: network->sms_queue->pending -= 1; -- cgit v1.2.3