1
0
Fork 0

misc. fixes

This commit is contained in:
bagyenda 2008-07-10 09:46:58 +00:00
parent 0cb6626339
commit fe4c53f2be
43 changed files with 171 additions and 123 deletions

View File

@ -1,3 +1,7 @@
2008-07-10 P. A. Bagyenda <bagyenda@dsmagic.com>
* Fixed minimum size of pgsql connection pool
* Fix for shutdown procedure
* Copyright notice updates
2008-07-09 P. A. Bagyenda <bagyenda@dsmagic.com>
* Fix for FROM address in MM4_delivery_report.REQ packet
2008-07-07 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -9,7 +9,7 @@
*
* Mbuni Queue handler module using PostgreSQL database storage
*
* Copyright (C) 2007, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2007-2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -24,7 +24,8 @@
#define MQF 'q'
static List *free_conns;
static int pgq_init_module(Octstr *conninfo)
static int pool_size;
static int pgq_init_module(Octstr *conninfo, int max_threads)
{
long i, n = 0;
@ -37,14 +38,20 @@ static int pgq_init_module(Octstr *conninfo)
if (n <= 0)
n = DEFAULT_CONNECTIONS;
else if (n <= max_threads * 4) { /* must all each thread up to 2 connections, and then some.*/
n = max_threads*4 + 1;
info(0, "pgsql_queue_init: Forced number of DB connections to %d", (int)n);
}
free_conns = gwlist_create();
gwlist_add_producer(free_conns);
for (i = 0; i<n;i++) {
PGconn *c = PQconnectdb(octstr_get_cstr(conninfo));
if (c && PQstatus(c) == CONNECTION_OK)
if (c && PQstatus(c) == CONNECTION_OK) {
gwlist_produce(free_conns, c);
else {
pool_size++;
} else {
error(0, "pgsql_queue.init: failed to connect to db: %s",
PQerrorMessage(c));
PQfinish(c);
@ -58,35 +65,44 @@ static int pgq_init_module(Octstr *conninfo)
static int pgq_cleanup_module(void)
{
gw_assert(free_conns);
gwlist_remove_producer(free_conns);
sleep(2);
gwlist_destroy(free_conns, (void *)PQfinish);
free_conns = NULL;
pool_size = 0;
return 0;
}
static PGconn *get_conn(void)
#define get_conn() get_conn_real(__FUNCTION__, __FILE__, __LINE__)
#define return_conn(conn) return_conn_real((conn), __FUNCTION__, __FILE__, __LINE__)
#define DEFAULT_PG_WAIT 30 /* fail after 2 minutes. */
static PGconn *get_conn_real(const char *function, const char *file, const int line)
{
PGconn *c;
PGresult *r;
if (free_conns == NULL) return NULL;
c = gwlist_consume(free_conns);
c = gwlist_timed_consume(free_conns, DEFAULT_PG_WAIT);
debug("pg_cp",0, "pg_get_conn> %s:%d, %s => %d", file, line, function, (int)c);
if (c) { /* might fail if we are shutting down. */
r = PQexec(c, "BEGIN"); /* start a transaction. */
PQclear(r);
}
} else
error(0, "pg_get_conn: Failed to get a free connection from connection pool! Consider increasing pool size (currently %d)?",
pool_size);
return c;
}
static void return_conn(PGconn *c)
static void return_conn_real(PGconn *c, const char *function, const char *file, const int line)
{
PGresult *r;
debug("pg_cp", 0, "pg_release_conn> %s:%d, %s => %d", file, line, function, (int)c);
if (free_conns == NULL) return;
/* commit or destroy transaction. */
@ -825,15 +841,6 @@ static void pgdeliver(List *item_list)
/* we're done, exit. */
}
#if 0
static int cmp_thread_data(char *qfname, struct Qthread_data_t *d)
{
gw_assert(qfname);
gw_assert(d);
return (strncmp(d->qf, qfname, sizeof d->qf) == 0);
}
#endif
static void pgq_queue_run(char *dir,
int (*deliver)(MmsEnvelope *),
double sleepsecs, int num_threads, int *rstop)
@ -842,17 +849,21 @@ static void pgq_queue_run(char *dir,
List *items_list = gwlist_create();
int i, n;
char cmd[512];
long *th_ids = NULL;
gw_assert(num_threads > 0);
info(0, "pgsql_queue: Queue runner on [%s] startup...", dir);
if (sleepsecs < MIN_QRUN_INTERVAL) {
warning(0, "minimum queue run interval for PG Queue module is %d secs.", MIN_QRUN_INTERVAL);
sleepsecs = MIN_QRUN_INTERVAL;
}
gwlist_add_producer(items_list);
th_ids = gw_malloc(num_threads*sizeof th_ids[0]);
for (i = 0; i<num_threads; i++)
gwthread_create((gwthread_func_t *)pgdeliver, items_list);
th_ids[i] = gwthread_create((gwthread_func_t *)pgdeliver, items_list);
/* Note that we get messages ready for delivery (whether or not they have expired).
* any other conditions will be handled by upper level,
@ -890,11 +901,21 @@ static void pgq_queue_run(char *dir,
break;
gwthread_sleep(sleepsecs);
} while (1);
info(0, "pgsql_queue: Queue runner on [%s] shutdown, started...", dir);
gwlist_remove_producer(items_list);
gwthread_join_every((gwthread_func_t *)pgdeliver); /* Wait for them all to terminate. */
for (i=0;i<num_threads; i++)
gwthread_cancel(th_ids[i]);
for (i=0;i<num_threads; i++)
gwthread_join(th_ids[i]);
gwlist_destroy(items_list, NULL);
gw_free(th_ids);
info(0, "pgsql_queue: Queue runner on [%s] shutdown, complete...", dir);
}
/* export functions... */

View File

@ -3,7 +3,7 @@
*
* MMS Config file reader functions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* config file functions
*
* Copyright (C) 2003 - 2006, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MM7/SOAP message encoder/decoder and helper functions
*
* Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MM7/SOAP message encoder/decoder and helper functions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Mbuni MMBox implementation
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Mbuni MMBox implementation
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MMS message encoder/decoder and helper functions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MMS message encoder/decoder and helper functions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Queue management functions
*
* Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -48,7 +48,7 @@ struct qfile_t { /* Name of the queue file, pointer to it (locked). D
static char sdir[QFNAMEMAX*2+1]; /* top-level storage directory. */
static int inited;
static int mms_init_queue_module(Octstr *storage_dir)
static int mms_init_queue_module(Octstr *storage_dir, int max_threads)
{
gw_assert(inited==0);
gw_assert(storage_dir);
@ -147,7 +147,7 @@ static int _putline(int fd, char *code, char buf[])
return res;
}
Octstr *xmake_qf(char realqf[], char subdir[])
static Octstr *xmake_qf(char realqf[], char subdir[])
{
Octstr *res = octstr_format("%s%s", subdir, realqf); /* Make the queue identifier -- convert '/' to '-' */

View File

@ -3,7 +3,7 @@
*
* Queue management functions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -77,7 +77,7 @@ typedef struct MmsEnvelope {
typedef struct MmsQueueHandlerFuncs {
/* Initialise queue module. Must be called at least once on each queue dir. */
int (*mms_init_queue_module)(Octstr *init_data);
int (*mms_init_queue_module)(Octstr *init_data, int max_threads);
/* initialise a queue directory. There can be multiple directories,
* upperlevel decides what a directory is.

View File

@ -3,7 +3,7 @@
*
* MMS strings module
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MMS strings module
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* User-Agent profiles handling, content adaptation.
*
* Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* User-Agent profiles handling, content adaptation.
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -622,7 +622,7 @@ int main(int argc, char *argv[])
qfs->mms_queue_run(octstr_get_cstr(incoming_qdir),
mmsbox_service_dispatch,
queue_interval, maxthreads, &rstop);
/* Wait for the sender thread, then quit. */
gwthread_join(qthread); /* Wait for it to die... */

View File

@ -3,7 +3,7 @@
*
* MMSBOX CFG: MMC configuration and misc. functions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -63,46 +63,6 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
mms_services = gwlist_create();
mmscs = gwlist_create();
gdir = mms_cfg_get(grp, octstr_imm("storage-directory"));
if (gdir == NULL)
gdir = octstr_imm(".");
if (mkdir(octstr_get_cstr(gdir),
S_IRWXU|S_IRWXG) < 0 &&
errno != EEXIST)
panic(0, "Failed to create MMSBox storage directory: %s - %s!",
octstr_get_cstr(gdir), strerror(errno));
if ((qfs = _mms_load_module(grp, "queue-manager-module", "qfuncs", NULL)) == NULL) {
qfs = &default_qfuncs; /* default queue handler. */
qfs->mms_init_queue_module(gdir);
} else {
Octstr *s = _mms_cfg_getx(grp, octstr_imm("queue-module-init-data"));
if (qfs->mms_init_queue_module(s) != 0)
panic(0, "failed to initialise queue module, with data: %s",
octstr_get_cstr(s));
octstr_destroy(s);
}
if ((incoming_qdir = qfs->mms_init_queue_dir("mmsbox_incoming", &xx)) == NULL ||
xx != 0)
panic(0, "Failed to initialise incoming mmsbox queue directory: %s - %s!",
octstr_get_cstr(incoming_qdir), strerror(errno));
if ((outgoing_qdir = qfs->mms_init_queue_dir("mmsbox_outgoing", &xx)) == NULL ||
xx != 0)
panic(0, "Failed to initialise outgoing mmsbox queue directory: %s - %s!",
octstr_get_cstr(outgoing_qdir), strerror(errno));
/* XXX still uses old-style file storage. */
if (qfs != &default_qfuncs)
default_qfuncs.mms_init_queue_module(gdir);
if ((dlr_dir = default_qfuncs.mms_init_queue_dir("mmsbox_dlr", &xx)) == NULL ||
xx != 0)
panic(0, "Failed to initialise dlr storage directory: %s - %s!",
octstr_get_cstr(dlr_dir), strerror(errno));
if (mms_cfg_get_int(grp,
octstr_imm("maximum-send-attempts"), &mmsbox_maxsendattempts) < 0)
mmsbox_maxsendattempts = MAXQTRIES;
@ -124,6 +84,47 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
}
if (queue_interval <= 0)
queue_interval = QUEUERUN_INTERVAL;
gdir = mms_cfg_get(grp, octstr_imm("storage-directory"));
if (gdir == NULL)
gdir = octstr_imm(".");
if (mkdir(octstr_get_cstr(gdir),
S_IRWXU|S_IRWXG) < 0 &&
errno != EEXIST)
panic(0, "Failed to create MMSBox storage directory: %s - %s!",
octstr_get_cstr(gdir), strerror(errno));
if ((qfs = _mms_load_module(grp, "queue-manager-module", "qfuncs", NULL)) == NULL) {
qfs = &default_qfuncs; /* default queue handler. */
qfs->mms_init_queue_module(gdir, maxthreads);
} else {
Octstr *s = _mms_cfg_getx(grp, octstr_imm("queue-module-init-data"));
if (qfs->mms_init_queue_module(s, maxthreads) != 0)
panic(0, "failed to initialise queue module, with data: %s",
octstr_get_cstr(s));
octstr_destroy(s);
}
if ((incoming_qdir = qfs->mms_init_queue_dir("mmsbox_incoming", &xx)) == NULL ||
xx != 0)
panic(0, "Failed to initialise incoming mmsbox queue directory: %s - %s!",
octstr_get_cstr(incoming_qdir), strerror(errno));
if ((outgoing_qdir = qfs->mms_init_queue_dir("mmsbox_outgoing", &xx)) == NULL ||
xx != 0)
panic(0, "Failed to initialise outgoing mmsbox queue directory: %s - %s!",
octstr_get_cstr(outgoing_qdir), strerror(errno));
/* XXX still uses old-style file storage. */
if (qfs != &default_qfuncs)
default_qfuncs.mms_init_queue_module(gdir, maxthreads);
if ((dlr_dir = default_qfuncs.mms_init_queue_dir("mmsbox_dlr", &xx)) == NULL ||
xx != 0)
panic(0, "Failed to initialise dlr storage directory: %s - %s!",
octstr_get_cstr(dlr_dir), strerror(errno));
unified_prefix = _mms_cfg_getx(grp, octstr_imm("unified-prefix"));
@ -576,3 +577,10 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
}
return 0;
}
void mmsbox_cleanup_mmsc_settings(void)
{
/* eventually we will destroy the object. For now, we only cleanup queue module. */
if (qfs)
qfs->mms_cleanup_queue_module();
}

View File

@ -3,7 +3,7 @@
*
* MMSBOX CFG: MMC configuration and misc. functions
*
* Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -118,4 +118,5 @@ extern MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from);
extern Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
Octstr **mmc_id);
extern void mmsbox_cleanup_mmsc_settings(void);
#endif

View File

@ -3,7 +3,7 @@
*
* MMSBOX Custom MMSC types: MMC function definitions
*
* Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Empty wrapper library
*
* Copyright (C) 20078 - , Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MMSBOX MT MMS filter: Optional filter for MT messages
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Resolving MSISDNs to local/remote MMSCs - calling shell scripts
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Resolving MSISDNs to local/remote MMSCs - interface (shell)
*
* Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Mbuni sample billing handler module
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Mbuni billing integration interface (shell)
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Mbuni MSISDN mapper sample
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Mbuni MSISDN mapper interface
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Mbuni MSISDN mapper interface (shell)
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Resolving MSISDNs to local/remote MMSCs
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Resolving MSISDNs to local/remote MMSCs - interface
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Resolving MSISDNs to local/remote MMSCs - calling shell scripts
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Resolving MSISDNs to local/remote MMSCs - interface (shell)
*
* Copyright (C) 2003 - 2006, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MMSC CFG: MMC configuration and misc. functions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -94,10 +94,10 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
if ((m->qfs = _mms_load_module(grp, "queue-manager-module", "qfuncs", NULL)) == NULL) {
m->qfs = &default_qfuncs; /* default queue handler. */
m->qfs->mms_init_queue_module(qdir);
m->qfs->mms_init_queue_module(qdir, m->maxthreads);
} else {
Octstr *s = _mms_cfg_getx(grp, octstr_imm("queue-module-init-data"));
if (m->qfs->mms_init_queue_module(s) != 0)
if (m->qfs->mms_init_queue_module(s, m->maxthreads) != 0)
panic(0, "failed to initialise queue module, with data: %s",
octstr_get_cstr(s));
octstr_destroy(s);

View File

@ -3,7 +3,7 @@
*
* MMSC CFG: MMC configuration and misc. functions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* Email2MMS and MM4 (incoming) interface
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MMS Global Queue Runner, routes messages generally.
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -468,7 +468,7 @@ void mbuni_global_queue_runner(int *rstop)
sleep(2);
gwlist_remove_producer(cdr_list); /* Stop CDR thread. */
gwlist_destroy(cdr_list, NULL); /* Destroy it. */
gwlist_destroy(cdr_list, NULL);
return;
}

View File

@ -4,7 +4,7 @@
* MMS client sender: notifications/reports to clients via WAP Push,
* manages out-going messages.
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -378,6 +378,8 @@ static int sendNotify(MmsEnvelope *e)
url = mms_makefetchurl(e->xqfname, e->token, MMS_LOC_MQUEUE,
phonenum ? phonenum : to,
settings);
info(0, "Preparing to notify client to fetch message at URL: %s",
octstr_get_cstr(url));
transid = mms_maketransid(e->xqfname, settings->host_alias);
smsg = mms_notification(msg, e->msize, url, transid,

View File

@ -3,7 +3,7 @@
*
* MMS Proxy interface, implements HTTP interface for client transactions
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -229,17 +229,21 @@ int main(int argc, char *argv[])
done:
debug("proxy", 0, "MM1 Shutting down...");
http_close_all_ports();
debug("proxy", 0, "Port closed");
mms_stop_profile_engine();
mms_cleanup_mmsc_settings(settings);
sleep(2); /* Give them time to shut down. */
if (mm7_thread >= 0)
gwthread_join(mm7_thread);
debug("proxy", 0, "Closed mm7 thread");
http_close_all_ports();
debug("proxy", 0, "Port closed");
sleep(2); /* Give them time to shut down. */
mms_stop_profile_engine();
sleep(2); /* Give them time to shut down. */
mms_cleanup_mmsc_settings(settings);
mms_lib_shutdown();
info(0, "mmsproxy: Shutdown complete");
return 0;
}

View File

@ -85,15 +85,20 @@ int main(int argc, char *argv[])
info(0, "Starting Local Queue Runner...");
mbuni_mm1_queue_runner(&rstop);
gwthread_cancel(qthread); /* force it to die if not yet dead. */
gwthread_join(qthread); /* Wait for it to die... */
sleep(2);
/* It terminates, so start dying... */
info(0, "Stopping profile engine...");
mms_stop_profile_engine(); /* Stop profile stuff. */
sleep(2); /* Wait for them to die. */
info(0, "Final cleanup...");
mms_cleanup_mmsc_settings(settings);
info(0, "Queue runners shutdown, cleanup commenced...");
gwthread_join(qthread); /* Wait for it to die... */
info(0, "Shutdown complete...");
mms_lib_shutdown();
return 0;
};

View File

@ -5,7 +5,7 @@
*
* MMS Relay, implements message routing
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*

View File

@ -3,7 +3,7 @@
*
* MMS send: Inject message into queue for delivery.
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
* Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
@ -23,7 +23,7 @@ static Octstr *from;
static List *to;
static Octstr *data;
static int savetommbox;
static int dlr;
static int find_own(int i, int argc, char *argv[])
{
@ -50,7 +50,10 @@ static int find_own(int i, int argc, char *argv[])
return 1;
} else
return -1;
else
else if (argv[i][1] == 'r') {
dlr = 1;
return 0;
} else
return -1;
}
@ -160,7 +163,7 @@ int main(int argc, char *argv[])
NULL, NULL,
NULL, NULL,
h,
0,
dlr,
octstr_get_cstr(settings->global_queuedir),
"MM3",
settings->host_alias);
@ -174,7 +177,7 @@ int main(int argc, char *argv[])
printf("Queued: %s, mmbox=%s\n",
octstr_get_cstr(s), mmbox ? octstr_get_cstr(mmbox) : "");
octstr_destroy(s);
http_destroy_headers(h);
mms_cleanup_mmsc_settings(settings);
mms_lib_shutdown();