Re: resend_try and sms_resend_frequency in splitted msgs

"Mi Reflejo" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Yes, agree.

What about check max tries from handle_split() and then resend.

Please check attached patch

M
On 6/21/06, Alexander Malysh <[email protected]> wrote:
> Hi Martin,
>
> unfortunately this patch will not work as expected and therefore -1 from me.
>
> With this change you put part of the message into the global queue where
> it will be retransmitted and also rerouted again. So if you have at
> least 2 equal SMSCs (egal in kannel config but not the same SMSC) here
> is the 50/50 possibility that this part will be routed via different
> SMSC and the whole message will be discarded at handset because of this.
>
> The thing with splitted messages is that they must go via the same SMSC.
>
> Thanks,
> Alex
>
> P.S. This bug known to me for at least 2 month but didn't find elegant
> solution yet. The easiest solution would be to just remove resend code
> if smsc active but it would cause more expenses because the whole
> message (all parts of the message) will be resend.
>
> Mi Reflejo schrieb:
> > When a msg is splitted and fails, handle_split() is called and every
> > sms_resend_retry conditions are ignored so msgs are retryed infinite
> > times.
> >
> > I'm attaching a patch to discuss.
> >
> > I don't know why handle_split() is calling smscconn_send() and is not
> > putting msgs in outgoing_sms queue.
> >
> > My patch put msg in outgoing_sms and check for resend_try before.
> >
> > It's working for me.
> >
> > Any comment?
> >
> > Martín.
>
>
>
retry_2.patch (application/octet-stream, 1.5 KB)
--- bb_smscconn.c.orig	2006-06-20 18:36:48.000000000 -0600
+++ bb_smscconn.c	2006-06-20 19:14:30.000000000 -0600
@@ -171,15 +171,20 @@
     struct split_parts *split = msg->sms.split_parts;
     
     /*
-     * If temporarely failed, try again immediately but only if connection active.
+     * If temporarely failed, try again if max retry is not reached (only if connection active).
      * Because if connection is not active we will loop for ever here consuming 100% CPU
      * time due to internal queue cleanup in smsc module that call bb_smscconn_failed.
      */
-    if (reason == SMSCCONN_FAILED_TEMPORARILY && smscconn_status(conn) == SMSCCONN_ACTIVE &&
-        smscconn_send(conn, msg) == 0) {
-        /* destroy this message because it will be duplicated in smsc module */
-        msg_destroy(msg);
-        return;
+    if (sms_resend_retry >= 0 && msg->sms.resend_try >= sms_resend_retry) {
+        warning(0, "Maximum retries for message exceeded, discarding it!");
+        reason = SMSCCONN_FAILED_DISCARDED;
+    } else {
+        msg->sms.resend_try = (msg->sms.resend_try > 0 ? msg->sms.resend_try + 1 : 1);
+        time(&msg->sms.resend_time);
+        if (reason == SMSCCONN_FAILED_TEMPORARILY && smscconn_status(conn) == SMSCCONN_ACTIVE){
+            debug("bb.sms", 0, "sms_router: Time to sleep %.2f secs", sms_resend_frequency);
+            gwthread_sleep(sms_resend_frequency);
+            if (smscconn_send(conn, msg) == 0) {
+                msg_destroy(msg);
+                return;
+            }
+        }
     }
     
     /*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.