Bug report: http://redmine.kannel.org/issues/show/529

Quote from gw/bb_smscconn.c :

static void handle_split(SMSCConn *conn, Msg *msg, long reason)
{
    struct split_parts *split = msg->sms.split_parts;

    /*
     * If temporarely failed, try again immediately but 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;
    }

(end quote)

So, if an smsc is alive and throws temporary error every time you try to
submit such a message, we enter endless loop of attempting to resend it....


Suggested patch follows (also attached).
Sorry its not cvs diff - having firewall issues accessing pserver now so i
ran diff vs snapshot generated yesterday
I will be able to produce a normal cvs diff tomorrow morning if it is needed


--- kannel-snapshot/gw/bb_smscconn.c    2009-11-15 16:12:28.000000000 +0200
+++ gateway-cvs/gw/bb_smscconn.c        2009-12-16 19:47:32.000000000 +0200
@@ -203,18 +203,6 @@
     struct split_parts *split = msg->sms.split_parts;

     /*
-     * If temporarely failed, try again immediately but 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 the reason is not a success and status is still success
      * then set status of a split to the reason.
      * Note: reason 'malformed','discarded' or 'rejected' has higher
priority!
@@ -303,7 +291,7 @@

 void bb_smscconn_send_failed(SMSCConn *conn, Msg *sms, int reason, Octstr
*reply)
 {
-    if (sms->sms.split_parts != NULL) {
+    if (reason != SMSCCONN_FAILED_TEMPORARILY && sms->sms.split_parts !=
NULL) {
         handle_split(conn, sms, reason);
         octstr_destroy(reply);
         return;
--- kannel-snapshot/gw/bb_smscconn.c	2009-11-15 16:12:28.000000000 +0200
+++ gateway-cvs/gw/bb_smscconn.c	2009-12-16 19:47:32.000000000 +0200
@@ -203,18 +203,6 @@
     struct split_parts *split = msg->sms.split_parts;
     
     /*
-     * If temporarely failed, try again immediately but 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 the reason is not a success and status is still success
      * then set status of a split to the reason.
      * Note: reason 'malformed','discarded' or 'rejected' has higher priority!
@@ -303,7 +291,7 @@
 
 void bb_smscconn_send_failed(SMSCConn *conn, Msg *sms, int reason, Octstr *reply)
 {
-    if (sms->sms.split_parts != NULL) {
+    if (reason != SMSCCONN_FAILED_TEMPORARILY && sms->sms.split_parts != NULL) {
         handle_split(conn, sms, reason);
         octstr_destroy(reply);
         return;

Reply via email to