resend_try and sms_resend_frequency in splitted msgs

"Mi Reflejo" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
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.patch (application/octet-stream, 1.3 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){
+            gwlist_produce(outgoing_sms, 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.