Patch to resolve out of order messages on retry to smsbox

Ben Suffolk <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
For a little context see this extract from a message I sent to the  
user list :

> What I thought was more interesting from my test was that I  
> received the messages out of order from when they were sent, I sent  
> 1,2,3,4 and actually received 2,3,4,1 at smsbx. For me this could  
> be a real issue as order of messages from users is important to me  
> (they build up a command, as opposed to being one-shot). Is there  
> anyway to stop bearerbox reordering the messages?

I investigated what was causing this and saw that once every 60  
seconds the messages got re-tried for smsbox routing. Looking in  
sms_to_smsboxes() in bb_boxc.c I could see that the first message was  
being looped to the back to the list, so every 60 seconds the first  
message was moved to be the last message.

This patch fixes the issue, so the list order is preserved.

Regards

Ben
sms_to_smsboxes.patch (application/octet-stream, 727 B)
Index: gw/bb_boxc.c
===================================================================
RCS file: /home/cvs/gateway/gw/bb_boxc.c,v
retrieving revision 1.85
diff -u -5 -r1.85 bb_boxc.c
--- gw/bb_boxc.c	23 Mar 2006 18:36:29 -0000	1.85
+++ gw/bb_boxc.c	2 Nov 2006 09:58:25 -0000
@@ -1520,10 +1520,16 @@
             /* debug("", 0, "gwlist_consume done 1"); */
             newmsg = NULL;
         }
         else {
             newmsg = msg = gwlist_consume(incoming_sms);
+            
+            /* Back at the first message? */
+            if (newmsg == startmsg) {
+                gwlist_insert(incoming_sms, 0, msg);
+                continue;
+            }
         }
 
         if (msg == NULL)
             break;
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.