diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-12-25 19:32:12 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-12-26 09:40:49 +0100 |
commit | 5479fc80d586b4e51e48e5ec80cd1cc4c4747c49 (patch) | |
tree | 7e840c138e31887460bd0866f4d0b649f8ecbc60 | |
parent | 203845730ff3f3456698a497ab8fddec0faa6a50 (diff) |
sms: Make sure that this loop is broken from time to time.
-rw-r--r-- | openbsc/src/sms_queue.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/openbsc/src/sms_queue.c b/openbsc/src/sms_queue.c index f6ac66090..dda8ce92b 100644 --- a/openbsc/src/sms_queue.c +++ b/openbsc/src/sms_queue.c @@ -219,7 +219,7 @@ static void sms_submit_pending(void *_data) int attempts = smsq->max_pending - smsq->pending; int initialized = 0; unsigned long long first_sub = 0; - int attempted = 0; + int attempted = 0, rounds = 0; LOGP(DSMS, LOGL_NOTICE, "Attempting to send %d SMS\n", attempts); @@ -232,6 +232,8 @@ static void sms_submit_pending(void *_data) if (!sms) break; + rounds += 1; + /* * This code needs to detect a loop. It assumes that no SMS * will vanish during the time this is executed. We will remember @@ -277,9 +279,9 @@ static void sms_submit_pending(void *_data) smsq->pending += 1; llist_add(&pending->entry, &smsq->pending_sms); gsm411_send_sms_subscr(sms->receiver, sms); - } while (attempted < attempts); + } while (attempted < attempts && rounds < 1000); - LOGP(DSMS, LOGL_DEBUG, "SMSqueue added %d messages\n", attempted); + LOGP(DSMS, LOGL_DEBUG, "SMSqueue added %d messages in %d rounds\n", attempted, rounds); } /* |