1
0
Fork 0

minor fixes, renamings

This commit is contained in:
bagyenda 2007-08-22 11:41:57 +00:00
parent 382c48bb69
commit 21f1188c4e
10 changed files with 40 additions and 33 deletions

View File

@ -1128,8 +1128,8 @@ static void mms_queue_run(char *dir,
goto qloop;
}
}
if (xdir)
octstr_destroy(xdir);
octstr_destroy(xdir);
if (*rstop)
break;
qloop:
@ -1157,7 +1157,7 @@ static int mms_cleanup_queue_module(void)
}
/* export functions... */
MmsQueueHandlerFuncs qfuncs = {
MmsQueueHandlerFuncs default_qfuncs = {
mms_init_queue_module,
mms_init_queue_dir,
mms_cleanup_queue_module,

View File

@ -147,9 +147,11 @@ typedef struct MmsQueueHandlerFuncs {
int (*mms_queue_free_env)(MmsEnvelope *e);
} MmsQueueHandlerFuncs;
/* Module must export this symbol: */
extern MmsQueueHandlerFuncs qfuncs;
/* Module must export this symbol:
* extern MmsQueueHandlerFuncs qfuncs;
*/
extern MmsQueueHandlerFuncs default_qfuncs; /* default queue handler module, file-based */
/* Utility functions, generally defined. */
/* Creates the queue envelope object, returns it. */
MmsEnvelope *mms_queue_create_envelope(Octstr *from, List *to,

View File

@ -1062,8 +1062,8 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
http_header_add(hdrs, "X-Mbuni-TransactionID", octstr_get_cstr(otransid));
if (distro) /* always add distrib */
http_header_add(hdrs, "X-Mbuni-DistributionIndicator", octstr_get_cstr(distro));
http_header_add(hdrs, "X-Mbuni-DistributionIndicator",
(octstr_str_case_compare(distro, "true") == 0) ? "true" : "false");
if (passthro_headers && reply_headers) { /* if user wants passthro headers, get them and add them. */
int n = gwlist_len(reply_headers);
int i;

View File

@ -107,7 +107,7 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
octstr_get_cstr(gdir), strerror(errno));
if ((qfs = load_module(grp, "queue-manager-module", "qfuncs")) == NULL) {
qfs = &qfuncs; /* default queue handler. */
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"));
@ -127,8 +127,11 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
panic(0, "Failed to initialise outgoing mmsbox queue directory: %s - %s!",
octstr_get_cstr(outgoing_qdir), strerror(errno));
if ((dlr_dir = qfuncs.mms_init_queue_dir("mmsbox_dlr", &xx)) == NULL ||
xx != 0) /* XXX still uses old-style file storage. */
/* 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));

View File

@ -72,6 +72,12 @@ static void *load_module(mCfgGrp *grp, char *config_key, char *symbolname,
return retval;
}
void mms_cleanup_mmsc_settings(MmscSettings *settings)
{
/* eventually we will destroy the object. For now, we only cleanup queue module. */
settings->qfs->mms_cleanup_queue_module();
}
MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
{
Octstr *s;
@ -83,7 +89,7 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
long port = -1;
Octstr *from, *user, *pass;
Octstr *qdir = NULL;
int i, n, xx;
int i, n, xx = 0;
memset(m, 0, sizeof *m);
@ -123,7 +129,7 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
octstr_get_cstr(qdir), strerror(errno));
if ((m->qfs = load_module(grp, "queue-manager-module", "qfuncs", NULL)) == NULL) {
m->qfs = &qfuncs; /* default queue handler. */
m->qfs = &default_qfuncs; /* default queue handler. */
m->qfs->mms_init_queue_module(qdir);
} else {
Octstr *s = _mms_cfg_getx(grp, octstr_imm("queue-module-init-data"));

View File

@ -107,6 +107,8 @@ typedef struct MmscSettings {
/* Returns mmsc settings. */
MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays);
/* do final cleanup. */
void mms_cleanup_mmsc_settings(MmscSettings *settings);
/* Returns list of MmsProxyRelay */
extern List *mms_proxy_relays(mCfg *cfg, Octstr *myhostname);

View File

@ -455,28 +455,20 @@ int main(int argc, char *argv[])
ack && octstr_str_case_compare(ack, "Yes") == 0)
send_mm4_res(mtype+1, orig_sys, me, transid, err, newmsgid);
if (mm4_type)
octstr_destroy(mm4_type);
if (transid)
octstr_destroy(transid);
if (orig_sys)
octstr_destroy(orig_sys);
if (msgid)
octstr_destroy(msgid);
if (newmsgid)
octstr_destroy(newmsgid);
if (rstatus)
octstr_destroy(rstatus);
if (xto)
octstr_destroy(xto);
if (xfrom)
octstr_destroy(xfrom);
if (xproxy)
octstr_destroy(xproxy);
octstr_destroy(mm4_type);
octstr_destroy(transid);
octstr_destroy(orig_sys);
octstr_destroy(msgid);
octstr_destroy(newmsgid);
octstr_destroy(rstatus);
octstr_destroy(xto);
octstr_destroy(xfrom);
octstr_destroy(xproxy);
octstr_destroy(me);
mms_destroy(msg);
mms_cleanup_mmsc_settings(settings);
mms_lib_shutdown();
return 0;

View File

@ -230,6 +230,8 @@ int main(int argc, char *argv[])
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();
return 0;
}

View File

@ -85,6 +85,7 @@ int main(int argc, char *argv[])
mms_stop_profile_engine(); /* Stop profile stuff. */
sleep(2); /* Wait for them to die. */
mms_cleanup_mmsc_settings(settings);
mms_lib_shutdown();
return 0;
};

View File

@ -170,9 +170,8 @@ int main(int argc, char *argv[])
octstr_get_cstr(s), mmbox ? octstr_get_cstr(mmbox) : "");
octstr_destroy(s);
if (h)
http_destroy_headers(h);
http_destroy_headers(h);
mms_cleanup_mmsc_settings(settings);
mms_lib_shutdown();
return 0;
}