1
0
Fork 0
mbuni/mbuni/mmsc/mmsrelay.c

55 lines
1.5 KiB
C
Raw Permalink Normal View History

/*
* Mbuni - Open Source MMS Gateway
*
* MMS Relay, implements message routing
*
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
*
* Paul Bagyenda <bagyenda@dsmagic.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License, with a few exceptions granted (see LICENSE)
*/
#include "mmsc.h"
static long qthread = -1;
2010-05-26 10:36:27 +00:00
static volatile sig_atomic_t rstop = 0; /* Set to 1 to stop relay. */
int mmsrelay()
2007-08-29 10:14:45 +00:00
{
2009-02-16 07:30:54 +00:00
if (!(settings->svc_list & (SvcMM1 | SvcRelay))) {
mms_info(0, "mmsrelay", NULL, " " MM_NAME " MMSC Relay version %s, no services to be started.", MMSC_VERSION);
return 0;
} else
mms_info(0, "mmsrelay", NULL, " " MM_NAME " MMSC Relay version %s starting", MMSC_VERSION);
/* Start global queue runner. */
2009-02-16 07:30:54 +00:00
if (settings->svc_list & SvcRelay) {
mms_info(0, "mmsrelay", NULL, "Starting Global Queue Runner...");
2010-10-21 17:51:16 +00:00
qthread = gwthread_create((gwthread_func_t *)mbuni_global_queue_runner, (void *)&rstop);
2009-02-16 07:30:54 +00:00
}
if (settings->svc_list & SvcMM1) {
/* Start the local queue runner. */
mms_info(0, "mmsrelay", NULL,"Starting Local Queue Runner...");
mbuni_mm1_queue_runner(&rstop);
}
2009-02-16 07:30:54 +00:00
if (qthread >= 0)
gwthread_join(qthread); /* Wait for it to die... */
2008-09-04 17:20:42 +00:00
mms_info(0, "mmsrelay", NULL, "MMSC Relay MM1 queue runner terminates...");
return 0;
}
2008-07-10 09:46:58 +00:00
int stop_mmsrelay(void)
{
rstop = 1;
2008-09-04 17:20:42 +00:00
mms_info(0, "mmsrelay", NULL, "Mmsrelay: Queue runners shutdown, cleanup commenced...");
return 0;
};