[PATCH] 'group = smsc' directive 'instances = x' to multiply the runtime instances
Stipe Tolj <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | Kannel Software Foundation (KSF) |
| Message-ID | <[email protected]> |
Hi list,
typically we have one config group towards an SMSC that we
copy-and-paste to create a number of same connection to it. The attached
patch allows to define this multiplication via the config directive
group = smsc
...
instances = <number>
...
The patchset is a feature add and a NLC.
BTW, it does NOT work for 'smsc = http' since the MO/DLR side HTTP port
will be bound already by the previous incarnation of the group, but I
think this is anyway not the type of SMSC group you would use the
multiplier for.
Please review and vote.
Stipe
--
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 DÃŒsseldorf, NRW, Germany
Kannel Foundation tolj.org system architecture
http://www.kannel.org/ http://www.tolj.org/
mailto:stolj_{at}_kannel.org mailto:st_{at}_tolj.org
-------------------------------------------------------------------
gateway-smsc-instances.diff
(text/plain, 3 KB)
Index: doc/userguide/userguide.xml
===================================================================
--- doc/userguide/userguide.xml (revision 5111)
+++ doc/userguide/userguide.xml (working copy)
@@ -2937,6 +2937,14 @@
to activate it. Defaults to 'false' if not present.</entry>
</row>
+ <row><entry><literal>instances</literal></entry>
+ <entry>number</entry>
+ The number of same instances of this group to be created. This allows to declare
+ the config group one time in the configuration and to multiply it by this value
+ for the numner of runtime instances. (default: 1)
+ </entry>
+ </row>
+
</tbody>
</tgroup>
</table>
Index: gw/bb_smscconn.c
===================================================================
--- gw/bb_smscconn.c (revision 5097)
+++ gw/bb_smscconn.c (working copy)
@@ -680,7 +680,7 @@
CfgGroup *grp;
SMSCConn *conn;
Octstr *os;
- int i;
+ int i, j, m;
if (smsc_running) return -1;
@@ -751,10 +751,14 @@
gwlist_add_producer(smsc_list);
for (i = 0; i < gwlist_len(smsc_groups) &&
(grp = gwlist_get(smsc_groups, i)) != NULL; i++) {
- conn = smscconn_create(grp, 1);
- if (conn == NULL)
- panic(0, "Cannot start with SMSC connection failing");
- gwlist_append(smsc_list, conn);
+ /* multiple instances for the same group? */
+ m = smscconn_instances(grp);
+ for (j = 0; j < m; j++) {
+ conn = smscconn_create(grp, 1);
+ if (conn == NULL)
+ panic(0, "Cannot start with SMSC connection failing");
+ gwlist_append(smsc_list, conn);
+ }
}
gwlist_remove_producer(smsc_list);
Index: gw/smscconn.c
===================================================================
--- gw/smscconn.c (revision 5097)
+++ gw/smscconn.c (working copy)
@@ -146,6 +146,19 @@
}
+unsigned int smscconn_instances(CfgGroup *grp)
+{
+ long i;
+
+ if (cfg_get_integer(&i, grp, octstr_imm("instances")) == -1)
+ i = 1;
+ else if (i < 0)
+ i = 0;
+
+ return i;
+}
+
+
SMSCConn *smscconn_create(CfgGroup *grp, int start_as_stopped)
{
SMSCConn *conn;
Index: gw/smscconn.h
===================================================================
--- gw/smscconn.h (revision 5097)
+++ gw/smscconn.h (working copy)
@@ -199,5 +199,12 @@
*/
int smscconn_info(SMSCConn *smscconn, StatusInfo *infotable);
+/* Determine if the specific SMS center group will be started
+ * with multiple instances.
+ * Return the number of multiple instances that should be started.
+ * If no multiple indicator is set in the config group, then 1
+ * is returned.
+ */
+unsigned int smscconn_instances(CfgGroup *grp);
#endif
Index: gwlib/cfg.def
===================================================================
--- gwlib/cfg.def (revision 5097)
+++ gwlib/cfg.def (working copy)
@@ -425,6 +425,7 @@
OCTSTR(generic-status-sent)
OCTSTR(generic-status-error)
OCTSTR(generic-foreign-id-regex)
+ OCTSTR(instances)
)