aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Whyte <keith@rhizomatica.org>2022-05-22 01:57:31 +0200
committerKeith Whyte <keith@rhizomatica.org>2022-05-22 11:08:15 +0200
commitdea294a25f71aba8a1be2e9738221f576caacdad (patch)
tree44d969965ea063494343dfb949e1157465fd3322
parent5f8ae371c619a71c3ef9574a8653cb80c93e149e (diff)
Just delete, don't bother marking sent first.
-rw-r--r--include/osmocom/msc/sms_queue.h19
-rw-r--r--src/libmsc/gsm_04_11.c10
-rw-r--r--src/libmsc/sms_queue.c19
3 files changed, 27 insertions, 21 deletions
diff --git a/include/osmocom/msc/sms_queue.h b/include/osmocom/msc/sms_queue.h
index a6e6aebd3..e4b2a120d 100644
--- a/include/osmocom/msc/sms_queue.h
+++ b/include/osmocom/msc/sms_queue.h
@@ -2,9 +2,26 @@
#define SMS_QUEUE_H
#include <stdbool.h>
+#include <osmocom/core/timer.h>
+#include <osmocom/msc/gsm_subscriber.h>
struct gsm_network;
-struct gsm_sms_queue;
+/* (global) state of the SMS queue. */
+struct gsm_sms_queue {
+ struct osmo_timer_list resend_pending; /* timer triggering sms_resend_pending() */
+ struct osmo_timer_list push_queue; /* timer triggering sms_submit_pending() */
+ struct gsm_network *network;
+ struct llist_head pending_sms; /* list of gsm_sms_pending */
+ struct sms_queue_config *cfg;
+ int pending; /* current number of gsm_sms_pending in RAM */
+
+ /* last MSISDN for which we read SMS from the database and created gsm_sms_pending records */
+ char last_msisdn[GSM23003_MSISDN_MAX_DIGITS+1];
+
+ /* statistics / counters */
+ struct osmo_stat_item_group *statg;
+ struct rate_ctr_group *ctrg;
+};
struct vty;
struct sms_queue_config {
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index 743e2722b..ae7f336d5 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -56,6 +56,7 @@
#include <osmocom/msc/msub.h>
#include <osmocom/msc/msc_a.h>
#include <osmocom/msc/paging.h>
+#include <osmocom/msc/sms_queue.h>
#ifdef BUILD_SMPP
#include "smpp_smsc.h"
@@ -845,6 +846,7 @@ static int gsm411_rx_rp_ack(struct gsm_trans *trans,
struct gsm411_rp_hdr *rph)
{
struct gsm_sms *sms = trans->sms.sms;
+ struct gsm_sms_queue *smq = trans->net->sms_queue;
/* Acnkowledgement to MT RP_DATA, i.e. the MS confirms it
* successfully received a SMS. We can now safely mark it as
@@ -861,8 +863,12 @@ static int gsm411_rx_rp_ack(struct gsm_trans *trans,
GSM411_RP_CAUSE_PROTOCOL_ERR);
}
- /* mark this SMS as sent in database */
- db_sms_mark_delivered(sms);
+ /* It seems there's little point in marking this SMS as sent in database
+ if the very next thing that happens to it is it will be deleted in the
+ signal callback. Let's do that deletion here. */
+
+ if (smq->cfg->delete_delivered == 0)
+ db_sms_mark_delivered(sms);
send_signal(S_SMS_DELIVERED, trans, sms, 0);
diff --git a/src/libmsc/sms_queue.c b/src/libmsc/sms_queue.c
index 9f18f4feb..560d394c6 100644
--- a/src/libmsc/sms_queue.c
+++ b/src/libmsc/sms_queue.c
@@ -119,23 +119,6 @@ struct gsm_sms_pending {
int resend; /* should we try re-sending it (now) ? */
};
-/* (global) state of the SMS queue. */
-struct gsm_sms_queue {
- struct osmo_timer_list resend_pending; /* timer triggering sms_resend_pending() */
- struct osmo_timer_list push_queue; /* timer triggering sms_submit_pending() */
- struct gsm_network *network;
- struct llist_head pending_sms; /* list of gsm_sms_pending */
- struct sms_queue_config *cfg;
- int pending; /* current number of gsm_sms_pending in RAM */
-
- /* last MSISDN for which we read SMS from the database and created gsm_sms_pending records */
- char last_msisdn[GSM23003_MSISDN_MAX_DIGITS+1];
-
- /* statistics / counters */
- struct osmo_stat_item_group *statg;
- struct rate_ctr_group *ctrg;
-};
-
/* private wrapper function to make sure we count all SMS delivery attempts */
static void _gsm411_send_sms(struct gsm_network *net, struct vlr_subscr *vsub, struct gsm_sms *sms)
{
@@ -620,7 +603,7 @@ static int sms_sms_cb(unsigned int subsys, unsigned int signal,
vsub = pending->vsub;
vlr_subscr_get(vsub, __func__);
if (smq->cfg->delete_delivered)
- db_sms_delete_sent_message_by_id(pending->sms_id);
+ db_sms_delete_message_by_id(pending->sms_id);
sms_pending_free(smq, pending);
/* Attempt to send another SMS to this subscriber */
sms_send_next(vsub);