[PATCH] No PANIC on failing store_load()

Stipe Tolj <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Kannel Software Foundation (KSF)
Message-ID <[email protected]>
Hi list,

attached is a very simple change in behavior in being more "runtime" 
constraining, in case a message in the spool has an invalid 'sms_type' 
we SHOULD NOT PANIC i.e. but rather dump an ERROR entry and try to continue.

Otherwise we may enter an infinite PANIC/restart loop for cases that 
such messages get somehow injected to the spool.

If no objections, will be committing soon.

Stipe

-- 
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 DÃŒsseldorf, NRW, Germany

tolj.org system architecture      Kannel Software Foundation (KSF)
http://www.tolj.org/              http://www.kannel.org/

mailto:st_{at}_tolj.org           mailto:stolj_{at}_kannel.org
-------------------------------------------------------------------
store_load_no_panic.diff (text/plain, 728 B)
Index: gw/bearerbox.c
===================================================================
--- gw/bearerbox.c	(revision 5048)
+++ gw/bearerbox.c	(working copy)
@@ -658,6 +658,8 @@
 
 static void dispatch_into_queue(Msg *msg)
 {
+    char id[UUID_STR_LEN + 1];
+
     gw_assert(msg != NULL),
     gw_assert(msg_type(msg) == sms);
 
@@ -672,7 +674,11 @@
             gwlist_append(incoming_sms, msg);
             break;
         default:
-            panic(0, "Not handled sms_type within store!");
+            uuid_unparse(msg->sms.id, id);
+            error(0, "Not handled sms_type %ld within store for message ID %s",
+                  msg->sms.sms_type, id);
+            msg_destroy(msg);
+            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.