misc. fixes
This commit is contained in:
parent
0cb6626339
commit
fe4c53f2be
|
@ -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>
|
2008-07-09 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
* Fix for FROM address in MM4_delivery_report.REQ packet
|
* Fix for FROM address in MM4_delivery_report.REQ packet
|
||||||
2008-07-07 P. A. Bagyenda <bagyenda@dsmagic.com>
|
2008-07-07 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* Mbuni Queue handler module using PostgreSQL database storage
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
@ -24,7 +24,8 @@
|
||||||
#define MQF 'q'
|
#define MQF 'q'
|
||||||
|
|
||||||
static List *free_conns;
|
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;
|
long i, n = 0;
|
||||||
|
|
||||||
|
@ -37,14 +38,20 @@ static int pgq_init_module(Octstr *conninfo)
|
||||||
|
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
n = DEFAULT_CONNECTIONS;
|
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();
|
free_conns = gwlist_create();
|
||||||
gwlist_add_producer(free_conns);
|
gwlist_add_producer(free_conns);
|
||||||
for (i = 0; i<n;i++) {
|
for (i = 0; i<n;i++) {
|
||||||
PGconn *c = PQconnectdb(octstr_get_cstr(conninfo));
|
PGconn *c = PQconnectdb(octstr_get_cstr(conninfo));
|
||||||
if (c && PQstatus(c) == CONNECTION_OK)
|
if (c && PQstatus(c) == CONNECTION_OK) {
|
||||||
gwlist_produce(free_conns, c);
|
gwlist_produce(free_conns, c);
|
||||||
else {
|
pool_size++;
|
||||||
|
} else {
|
||||||
error(0, "pgsql_queue.init: failed to connect to db: %s",
|
error(0, "pgsql_queue.init: failed to connect to db: %s",
|
||||||
PQerrorMessage(c));
|
PQerrorMessage(c));
|
||||||
PQfinish(c);
|
PQfinish(c);
|
||||||
|
@ -58,35 +65,44 @@ static int pgq_init_module(Octstr *conninfo)
|
||||||
static int pgq_cleanup_module(void)
|
static int pgq_cleanup_module(void)
|
||||||
{
|
{
|
||||||
gw_assert(free_conns);
|
gw_assert(free_conns);
|
||||||
|
|
||||||
gwlist_remove_producer(free_conns);
|
gwlist_remove_producer(free_conns);
|
||||||
sleep(2);
|
sleep(2);
|
||||||
gwlist_destroy(free_conns, (void *)PQfinish);
|
gwlist_destroy(free_conns, (void *)PQfinish);
|
||||||
free_conns = NULL;
|
free_conns = NULL;
|
||||||
|
pool_size = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define get_conn() get_conn_real(__FUNCTION__, __FILE__, __LINE__)
|
||||||
static PGconn *get_conn(void)
|
#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;
|
PGconn *c;
|
||||||
PGresult *r;
|
PGresult *r;
|
||||||
|
|
||||||
if (free_conns == NULL) return NULL;
|
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. */
|
if (c) { /* might fail if we are shutting down. */
|
||||||
r = PQexec(c, "BEGIN"); /* start a transaction. */
|
r = PQexec(c, "BEGIN"); /* start a transaction. */
|
||||||
PQclear(r);
|
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;
|
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;
|
PGresult *r;
|
||||||
|
|
||||||
|
debug("pg_cp", 0, "pg_release_conn> %s:%d, %s => %d", file, line, function, (int)c);
|
||||||
|
|
||||||
if (free_conns == NULL) return;
|
if (free_conns == NULL) return;
|
||||||
|
|
||||||
/* commit or destroy transaction. */
|
/* commit or destroy transaction. */
|
||||||
|
@ -825,15 +841,6 @@ static void pgdeliver(List *item_list)
|
||||||
/* we're done, exit. */
|
/* 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,
|
static void pgq_queue_run(char *dir,
|
||||||
int (*deliver)(MmsEnvelope *),
|
int (*deliver)(MmsEnvelope *),
|
||||||
double sleepsecs, int num_threads, int *rstop)
|
double sleepsecs, int num_threads, int *rstop)
|
||||||
|
@ -842,17 +849,21 @@ static void pgq_queue_run(char *dir,
|
||||||
List *items_list = gwlist_create();
|
List *items_list = gwlist_create();
|
||||||
int i, n;
|
int i, n;
|
||||||
char cmd[512];
|
char cmd[512];
|
||||||
|
long *th_ids = NULL;
|
||||||
|
|
||||||
gw_assert(num_threads > 0);
|
gw_assert(num_threads > 0);
|
||||||
|
|
||||||
|
info(0, "pgsql_queue: Queue runner on [%s] startup...", dir);
|
||||||
if (sleepsecs < MIN_QRUN_INTERVAL) {
|
if (sleepsecs < MIN_QRUN_INTERVAL) {
|
||||||
warning(0, "minimum queue run interval for PG Queue module is %d secs.", MIN_QRUN_INTERVAL);
|
warning(0, "minimum queue run interval for PG Queue module is %d secs.", MIN_QRUN_INTERVAL);
|
||||||
sleepsecs = MIN_QRUN_INTERVAL;
|
sleepsecs = MIN_QRUN_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gwlist_add_producer(items_list);
|
gwlist_add_producer(items_list);
|
||||||
|
th_ids = gw_malloc(num_threads*sizeof th_ids[0]);
|
||||||
|
|
||||||
for (i = 0; i<num_threads; i++)
|
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).
|
/* Note that we get messages ready for delivery (whether or not they have expired).
|
||||||
* any other conditions will be handled by upper level,
|
* any other conditions will be handled by upper level,
|
||||||
|
@ -890,11 +901,21 @@ static void pgq_queue_run(char *dir,
|
||||||
break;
|
break;
|
||||||
gwthread_sleep(sleepsecs);
|
gwthread_sleep(sleepsecs);
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
|
info(0, "pgsql_queue: Queue runner on [%s] shutdown, started...", dir);
|
||||||
gwlist_remove_producer(items_list);
|
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);
|
gwlist_destroy(items_list, NULL);
|
||||||
|
gw_free(th_ids);
|
||||||
|
|
||||||
|
info(0, "pgsql_queue: Queue runner on [%s] shutdown, complete...", dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* export functions... */
|
/* export functions... */
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMS Config file reader functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* config file functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MM7/SOAP message encoder/decoder and helper functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MM7/SOAP message encoder/decoder and helper functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Mbuni MMBox implementation
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Mbuni MMBox implementation
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMS message encoder/decoder and helper functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMS message encoder/decoder and helper functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Queue management functions
|
* 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>
|
* 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 char sdir[QFNAMEMAX*2+1]; /* top-level storage directory. */
|
||||||
static int inited;
|
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(inited==0);
|
||||||
gw_assert(storage_dir);
|
gw_assert(storage_dir);
|
||||||
|
@ -147,7 +147,7 @@ static int _putline(int fd, char *code, char buf[])
|
||||||
return res;
|
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 '-' */
|
Octstr *res = octstr_format("%s%s", subdir, realqf); /* Make the queue identifier -- convert '/' to '-' */
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Queue management functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
@ -77,7 +77,7 @@ typedef struct MmsEnvelope {
|
||||||
|
|
||||||
typedef struct MmsQueueHandlerFuncs {
|
typedef struct MmsQueueHandlerFuncs {
|
||||||
/* Initialise queue module. Must be called at least once on each queue dir. */
|
/* 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,
|
/* initialise a queue directory. There can be multiple directories,
|
||||||
* upperlevel decides what a directory is.
|
* upperlevel decides what a directory is.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMS strings module
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMS strings module
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* User-Agent profiles handling, content adaptation.
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* User-Agent profiles handling, content adaptation.
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -622,7 +622,7 @@ int main(int argc, char *argv[])
|
||||||
qfs->mms_queue_run(octstr_get_cstr(incoming_qdir),
|
qfs->mms_queue_run(octstr_get_cstr(incoming_qdir),
|
||||||
mmsbox_service_dispatch,
|
mmsbox_service_dispatch,
|
||||||
queue_interval, maxthreads, &rstop);
|
queue_interval, maxthreads, &rstop);
|
||||||
|
|
||||||
/* Wait for the sender thread, then quit. */
|
/* Wait for the sender thread, then quit. */
|
||||||
gwthread_join(qthread); /* Wait for it to die... */
|
gwthread_join(qthread); /* Wait for it to die... */
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMSBOX CFG: MMC configuration and misc. functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -63,46 +63,6 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
|
||||||
mms_services = gwlist_create();
|
mms_services = gwlist_create();
|
||||||
mmscs = 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,
|
if (mms_cfg_get_int(grp,
|
||||||
octstr_imm("maximum-send-attempts"), &mmsbox_maxsendattempts) < 0)
|
octstr_imm("maximum-send-attempts"), &mmsbox_maxsendattempts) < 0)
|
||||||
mmsbox_maxsendattempts = MAXQTRIES;
|
mmsbox_maxsendattempts = MAXQTRIES;
|
||||||
|
@ -124,6 +84,47 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
|
||||||
}
|
}
|
||||||
if (queue_interval <= 0)
|
if (queue_interval <= 0)
|
||||||
queue_interval = QUEUERUN_INTERVAL;
|
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"));
|
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;
|
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();
|
||||||
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMSBOX CFG: MMC configuration and misc. functions
|
* 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>
|
* 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,
|
extern Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
||||||
Octstr **mmc_id);
|
Octstr **mmc_id);
|
||||||
|
extern void mmsbox_cleanup_mmsc_settings(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMSBOX Custom MMSC types: MMC function definitions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Empty wrapper library
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMSBOX MT MMS filter: Optional filter for MT messages
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Resolving MSISDNs to local/remote MMSCs - calling shell scripts
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Resolving MSISDNs to local/remote MMSCs - interface (shell)
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Mbuni sample billing handler module
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Mbuni billing integration interface (shell)
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Mbuni MSISDN mapper sample
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Mbuni MSISDN mapper interface
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Mbuni MSISDN mapper interface (shell)
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Resolving MSISDNs to local/remote MMSCs
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Resolving MSISDNs to local/remote MMSCs - interface
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Resolving MSISDNs to local/remote MMSCs - calling shell scripts
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Resolving MSISDNs to local/remote MMSCs - interface (shell)
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMSC CFG: MMC configuration and misc. functions
|
* 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>
|
* 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) {
|
if ((m->qfs = _mms_load_module(grp, "queue-manager-module", "qfuncs", NULL)) == NULL) {
|
||||||
m->qfs = &default_qfuncs; /* default queue handler. */
|
m->qfs = &default_qfuncs; /* default queue handler. */
|
||||||
m->qfs->mms_init_queue_module(qdir);
|
m->qfs->mms_init_queue_module(qdir, m->maxthreads);
|
||||||
} else {
|
} else {
|
||||||
Octstr *s = _mms_cfg_getx(grp, octstr_imm("queue-module-init-data"));
|
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",
|
panic(0, "failed to initialise queue module, with data: %s",
|
||||||
octstr_get_cstr(s));
|
octstr_get_cstr(s));
|
||||||
octstr_destroy(s);
|
octstr_destroy(s);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMSC CFG: MMC configuration and misc. functions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Email2MMS and MM4 (incoming) interface
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMS Global Queue Runner, routes messages generally.
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
@ -468,7 +468,7 @@ void mbuni_global_queue_runner(int *rstop)
|
||||||
sleep(2);
|
sleep(2);
|
||||||
gwlist_remove_producer(cdr_list); /* Stop CDR thread. */
|
gwlist_remove_producer(cdr_list); /* Stop CDR thread. */
|
||||||
|
|
||||||
gwlist_destroy(cdr_list, NULL); /* Destroy it. */
|
gwlist_destroy(cdr_list, NULL);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* MMS client sender: notifications/reports to clients via WAP Push,
|
* MMS client sender: notifications/reports to clients via WAP Push,
|
||||||
* manages out-going messages.
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
@ -378,6 +378,8 @@ static int sendNotify(MmsEnvelope *e)
|
||||||
url = mms_makefetchurl(e->xqfname, e->token, MMS_LOC_MQUEUE,
|
url = mms_makefetchurl(e->xqfname, e->token, MMS_LOC_MQUEUE,
|
||||||
phonenum ? phonenum : to,
|
phonenum ? phonenum : to,
|
||||||
settings);
|
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);
|
transid = mms_maketransid(e->xqfname, settings->host_alias);
|
||||||
|
|
||||||
smsg = mms_notification(msg, e->msize, url, transid,
|
smsg = mms_notification(msg, e->msize, url, transid,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMS Proxy interface, implements HTTP interface for client transactions
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
@ -229,17 +229,21 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
done:
|
done:
|
||||||
debug("proxy", 0, "MM1 Shutting down...");
|
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)
|
if (mm7_thread >= 0)
|
||||||
gwthread_join(mm7_thread);
|
gwthread_join(mm7_thread);
|
||||||
debug("proxy", 0, "Closed 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();
|
mms_lib_shutdown();
|
||||||
|
info(0, "mmsproxy: Shutdown complete");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,15 +85,20 @@ int main(int argc, char *argv[])
|
||||||
info(0, "Starting Local Queue Runner...");
|
info(0, "Starting Local Queue Runner...");
|
||||||
mbuni_mm1_queue_runner(&rstop);
|
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... */
|
/* It terminates, so start dying... */
|
||||||
|
info(0, "Stopping profile engine...");
|
||||||
mms_stop_profile_engine(); /* Stop profile stuff. */
|
mms_stop_profile_engine(); /* Stop profile stuff. */
|
||||||
|
|
||||||
sleep(2); /* Wait for them to die. */
|
sleep(2); /* Wait for them to die. */
|
||||||
|
info(0, "Final cleanup...");
|
||||||
mms_cleanup_mmsc_settings(settings);
|
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();
|
mms_lib_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* MMS Relay, implements message routing
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* MMS send: Inject message into queue for delivery.
|
* 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>
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
*
|
*
|
||||||
|
@ -23,7 +23,7 @@ static Octstr *from;
|
||||||
static List *to;
|
static List *to;
|
||||||
static Octstr *data;
|
static Octstr *data;
|
||||||
static int savetommbox;
|
static int savetommbox;
|
||||||
|
static int dlr;
|
||||||
static int find_own(int i, int argc, char *argv[])
|
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;
|
return 1;
|
||||||
} else
|
} else
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else if (argv[i][1] == 'r') {
|
||||||
|
dlr = 1;
|
||||||
|
return 0;
|
||||||
|
} else
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +163,7 @@ int main(int argc, char *argv[])
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
h,
|
h,
|
||||||
0,
|
dlr,
|
||||||
octstr_get_cstr(settings->global_queuedir),
|
octstr_get_cstr(settings->global_queuedir),
|
||||||
"MM3",
|
"MM3",
|
||||||
settings->host_alias);
|
settings->host_alias);
|
||||||
|
@ -174,7 +177,7 @@ int main(int argc, char *argv[])
|
||||||
printf("Queued: %s, mmbox=%s\n",
|
printf("Queued: %s, mmbox=%s\n",
|
||||||
octstr_get_cstr(s), mmbox ? octstr_get_cstr(mmbox) : "");
|
octstr_get_cstr(s), mmbox ? octstr_get_cstr(mmbox) : "");
|
||||||
octstr_destroy(s);
|
octstr_destroy(s);
|
||||||
|
|
||||||
http_destroy_headers(h);
|
http_destroy_headers(h);
|
||||||
mms_cleanup_mmsc_settings(settings);
|
mms_cleanup_mmsc_settings(settings);
|
||||||
mms_lib_shutdown();
|
mms_lib_shutdown();
|
||||||
|
|
Loading…
Reference in New Issue