*** empty log message ***
This commit is contained in:
parent
b7bd482849
commit
2236d0e9e5
|
@ -629,6 +629,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (sendmms_port.port > 0)
|
if (sendmms_port.port > 0)
|
||||||
gwthread_join(sthread);
|
gwthread_join(sthread);
|
||||||
|
|
||||||
|
mmsbox_settings_cleanup();
|
||||||
info(0, "Shutdown complete..");
|
info(0, "Shutdown complete..");
|
||||||
|
|
||||||
mms_lib_shutdown();
|
mms_lib_shutdown();
|
||||||
|
|
|
@ -26,14 +26,14 @@
|
||||||
|
|
||||||
#define WAIT_TIME 0.2
|
#define WAIT_TIME 0.2
|
||||||
|
|
||||||
List *sendmms_users = NULL; /* list of SendMmsUser structs */
|
List *sendmms_users = NULL; /* list of SendMmsUser structs */
|
||||||
List *mms_services = NULL; /* list of MMS Services */
|
List *mms_services = NULL; /* list of MMS Services */
|
||||||
Octstr *incoming_qdir, *outgoing_qdir, *dlr_dir;
|
Octstr *incoming_qdir, *outgoing_qdir, *dlr_dir;
|
||||||
long mmsbox_maxsendattempts, mmsbox_send_back_off, default_msgexpiry;
|
long mmsbox_maxsendattempts, mmsbox_send_back_off, default_msgexpiry;
|
||||||
long maxthreads = 0;
|
long maxthreads = 0;
|
||||||
double queue_interval = -1;
|
double queue_interval = -1;
|
||||||
Octstr *unified_prefix = NULL;
|
Octstr *unified_prefix = NULL;
|
||||||
List *strip_prefixes = NULL;
|
List *strip_prefixes = NULL;
|
||||||
Octstr *sendmail_cmd = NULL;
|
Octstr *sendmail_cmd = NULL;
|
||||||
Octstr *myhostname = NULL;
|
Octstr *myhostname = NULL;
|
||||||
|
|
||||||
|
@ -45,7 +45,8 @@ Octstr *rfs_settings;
|
||||||
|
|
||||||
|
|
||||||
static Dict *mmscs = NULL; /* MMSC's indexed by ID. */
|
static Dict *mmscs = NULL; /* MMSC's indexed by ID. */
|
||||||
|
static List *mmsc_del_list = NULL; /* List of items to be deleted. */
|
||||||
|
|
||||||
struct SendMmsPortInfo sendmms_port;
|
struct SendMmsPortInfo sendmms_port;
|
||||||
|
|
||||||
struct MmsBoxMTfilter *mt_filter = NULL;
|
struct MmsBoxMTfilter *mt_filter = NULL;
|
||||||
|
@ -73,6 +74,8 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
|
||||||
mms_services = gwlist_create();
|
mms_services = gwlist_create();
|
||||||
mmscs = dict_create(101, NULL);
|
mmscs = dict_create(101, NULL);
|
||||||
|
|
||||||
|
mmsc_del_list = gwlist_create();
|
||||||
|
|
||||||
if (mms_cfg_get_int(cfg, grp,
|
if (mms_cfg_get_int(cfg, grp,
|
||||||
octstr_imm("maximum-send-attempts"), &mmsbox_maxsendattempts) < 0)
|
octstr_imm("maximum-send-attempts"), &mmsbox_maxsendattempts) < 0)
|
||||||
mmsbox_maxsendattempts = MAXQTRIES;
|
mmsbox_maxsendattempts = MAXQTRIES;
|
||||||
|
@ -546,10 +549,8 @@ void mmsbox_stop_mmsc_conn(Octstr *mmc_id)
|
||||||
|
|
||||||
mmsbox_stop_mmsc_conn_real(mmc);
|
mmsbox_stop_mmsc_conn_real(mmc);
|
||||||
|
|
||||||
while (mmc->use_count > 0) /* wait for use count to reach 0, then delete it. */
|
mmc->delete_after = time(NULL) + 5*60; /* delete after 5 minutes. */
|
||||||
gwthread_sleep(WAIT_TIME);
|
gwlist_append(mmsc_del_list, mmc); /* to be deleted later. */
|
||||||
|
|
||||||
free_mmsc_struct(mmc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmsbox_stop_all_mmsc_conn(void)
|
void mmsbox_stop_all_mmsc_conn(void)
|
||||||
|
@ -635,11 +636,45 @@ done:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void delete_stale_mmsc(int delete_all)
|
||||||
|
{
|
||||||
|
MmscGrp *mmc;
|
||||||
|
int n = gwlist_len(mmsc_del_list);
|
||||||
|
|
||||||
|
while (n-- > 0 &&
|
||||||
|
(mmc = gwlist_extract_first(mmsc_del_list)) != NULL)
|
||||||
|
if (delete_all ||
|
||||||
|
(mmc->use_count <= 0 &&
|
||||||
|
mmc->delete_after <= time(NULL)))
|
||||||
|
free_mmsc_struct(mmc);
|
||||||
|
else
|
||||||
|
gwlist_append(mmsc_del_list, mmc); /* put it back. */
|
||||||
|
|
||||||
|
if (delete_all) {
|
||||||
|
gwlist_destroy(mmsc_del_list, NULL);
|
||||||
|
mmsc_del_list = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mmsbox_settings_cleanup(void)
|
||||||
|
{
|
||||||
|
delete_stale_mmsc(1);
|
||||||
|
|
||||||
|
/* More cleanups to follow. */
|
||||||
|
}
|
||||||
|
|
||||||
void return_mmsc_conn(MmscGrp *m)
|
void return_mmsc_conn(MmscGrp *m)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m)
|
if (m)
|
||||||
MMSBOX_MMSC_UNMARK_INUSE(m); /* Vital! */
|
MMSBOX_MMSC_UNMARK_INUSE(m); /* Vital! */
|
||||||
|
|
||||||
|
/* now try and delete as many to-be-deleted mmc as possible */
|
||||||
|
delete_stale_mmsc(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handle message routing. */
|
/* handle message routing. */
|
||||||
Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
||||||
Octstr **mmc_id)
|
Octstr **mmc_id)
|
||||||
|
|
|
@ -50,6 +50,7 @@ typedef struct MmscGrp {
|
||||||
int custom_started; /* set to 1 if custom mmc started. */
|
int custom_started; /* set to 1 if custom mmc started. */
|
||||||
|
|
||||||
int use_count; /* use counter. */
|
int use_count; /* use counter. */
|
||||||
|
time_t delete_after; /* used to control deletion of object -- not ver clean, but... */
|
||||||
} MmscGrp;
|
} MmscGrp;
|
||||||
|
|
||||||
#define MMSBOX_MMSC_MARK_INUSE(mmc) do {\
|
#define MMSBOX_MMSC_MARK_INUSE(mmc) do {\
|
||||||
|
@ -131,6 +132,7 @@ extern Octstr *rfs_settings;
|
||||||
|
|
||||||
|
|
||||||
extern int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func);
|
extern int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func);
|
||||||
|
extern void mmsbox_settings_cleanup(void);
|
||||||
extern MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from);
|
extern MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from);
|
||||||
extern void return_mmsc_conn(MmscGrp *m);
|
extern void return_mmsc_conn(MmscGrp *m);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue