aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/vty_interface_layer3.c
diff options
context:
space:
mode:
authorSylvain Munaut <246tnt@gmail.com>2009-12-22 13:22:29 +0100
committerHarald Welte <laforge@gnumonks.org>2009-12-22 13:22:29 +0100
commitff1f19e199bbb0cb9da55e0994d9b1443bba85f7 (patch)
tree7cecfe2fc2f8104999c9db0ab2c11a3909389f44 /openbsc/src/vty_interface_layer3.c
parent9c4f6b5dca610bce313911bb81b3d3081f662d31 (diff)
Implement a better sending of pending SMS
The previous implementation had some shortcomings: - If the MIN ID given was not the exact id of the first unsent SMS, it would try to submit the same sms several time until id++ finally made id go to the next one. - If a subscriber had several SMS pending it would try to submit them individually (only to get rejected because a paging for that subscriber was already in progress) Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'openbsc/src/vty_interface_layer3.c')
-rw-r--r--openbsc/src/vty_interface_layer3.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index 4cc08c2da..70e8445f0 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -143,23 +143,20 @@ DEFUN(show_subscr_cache,
DEFUN(sms_send_pend,
sms_send_pend_cmd,
- "sms send pending MIN_ID",
- "Send all pending SMS starting from MIN_ID")
+ "sms send pending",
+ "Send all pending SMS")
{
struct gsm_sms *sms;
- int id = atoi(argv[0]);
+ int id = 0;
while (1) {
- sms = db_sms_get_unsent(gsmnet, id++);
+ sms = db_sms_get_unsent_by_subscr(gsmnet, id);
if (!sms)
- return CMD_WARNING;
-
- if (!sms->receiver) {
- sms_free(sms);
- continue;
- }
+ break;
gsm411_send_sms_subscr(sms->receiver, sms);
+
+ id = sms->receiver->id + 1;
}
return CMD_SUCCESS;