1
0
Fork 0

admin fixes

This commit is contained in:
bagyenda 2009-01-12 15:33:20 +00:00
parent 76cb3e6f5b
commit 037183a65a
2 changed files with 45 additions and 41 deletions

View File

@ -1,5 +1,6 @@
2009-01-12 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fixes: Output from admin interfaces always valid XML
* Minor fixes: admin module
2008-12-24 P. A. Bagyenda <bagyenda@dsmagic.com>
* Improved MM1 performance
2008-12-17 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -671,7 +671,7 @@ static void delete_stale_mmsc(int delete_all)
MmscGrp *mmc;
int n = gwlist_len(mmsc_del_list);
while (n-- > 0 &&
while (n-- > 0 && mmsc_del_list &&
(mmc = gwlist_extract_first(mmsc_del_list)) != NULL)
if (delete_all ||
(mmc->use_count <= 0 &&
@ -707,13 +707,14 @@ void mmsbox_stop_all_mmsc_conn(void)
Octstr *mmc;
List *l = dict_keys(mmscs);
while ((mmc = gwlist_extract_first(l)) != NULL) {
mms_info(0, "mmsbox", NULL,"Stopping MMSC [%s]", octstr_get_cstr(mmc));
mmsbox_stop_mmsc_conn(mmc);
octstr_destroy(mmc);
if (l) {
while ((mmc = gwlist_extract_first(l)) != NULL) {
mms_info(0, "mmsbox", NULL,"Stopping MMSC [%s]", octstr_get_cstr(mmc));
mmsbox_stop_mmsc_conn(mmc);
octstr_destroy(mmc);
}
gwlist_destroy(l, NULL);
}
gwlist_destroy(l, NULL);
}
/* Get the MMC that should handler this recipient. */
@ -1014,27 +1015,27 @@ static void admin_handler(void *unused)
gwlist_append(l, m);
}
/* Start MMSCs. */
while ((m = gwlist_extract_first(l)) != NULL) {
List *e = gwlist_create();
List *w = gwlist_create();
Octstr *x;
MmscGrp *mc = start_mmsc_from_conf(cfg, m, mmsc_receiver_func, e, w);
if (mc != NULL)
append_mmsc_status(rbody, mc, w);
else if (gwlist_len(e) > 0)
while ((x = gwlist_extract_first(e)) != NULL) {
octstr_format_append(rbody,
"<Start-Mmsc><Error>%S</Error></Start-Mmsc>\n",
x);
octstr_destroy(x);
}
gwlist_destroy(e, (void *)octstr_destroy);
gwlist_destroy(w, (void *)octstr_destroy);
mms_cfg_destroy_grp(cfg, m);
}
if (l)
while ((m = gwlist_extract_first(l)) != NULL) {
List *e = gwlist_create();
List *w = gwlist_create();
Octstr *x;
MmscGrp *mc = start_mmsc_from_conf(cfg, m, mmsc_receiver_func, e, w);
if (mc != NULL)
append_mmsc_status(rbody, mc, w);
else if (gwlist_len(e) > 0)
while ((x = gwlist_extract_first(e)) != NULL) {
octstr_format_append(rbody,
"<Start-Mmsc><Error>%S</Error></Start-Mmsc>\n",
x);
octstr_destroy(x);
}
gwlist_destroy(e, (void *)octstr_destroy);
gwlist_destroy(w, (void *)octstr_destroy);
mms_cfg_destroy_grp(cfg, m);
}
} else if (octstr_str_case_compare(url, "/stop") == 0) {
Octstr *x;
if (mmc_id == NULL)
@ -1044,13 +1045,14 @@ static void admin_handler(void *unused)
gwlist_append(l, octstr_duplicate(mmc_id));
}
while ((x = gwlist_extract_first(l)) != NULL) {
int ret = mmsbox_stop_mmsc_conn(x);
octstr_format_append(rbody,
"<Stop-Mmsc><%s/></Stop-Mmsc>\n",
ret == 0 ? "Success" : "Failed");
octstr_destroy(x);
}
if (l)
while ((x = gwlist_extract_first(l)) != NULL) {
int ret = mmsbox_stop_mmsc_conn(x);
octstr_format_append(rbody,
"<Stop-Mmsc><%s/></Stop-Mmsc>\n",
ret == 0 ? "Success" : "Failed");
octstr_destroy(x);
}
} else if (octstr_str_case_compare(url, "/status") == 0) {
Octstr *x;
@ -1061,12 +1063,13 @@ static void admin_handler(void *unused)
l = gwlist_create();
gwlist_append(l, octstr_duplicate(mmc_id));
}
while ((x = gwlist_extract_first(l)) != NULL) {
if ((mc = dict_get(mmscs, x)) != NULL)
append_mmsc_status(rbody, mc, NULL);
octstr_destroy(x);
}
if (l)
while ((x = gwlist_extract_first(l)) != NULL) {
if ((mc = dict_get(mmscs, x)) != NULL)
append_mmsc_status(rbody, mc, NULL);
octstr_destroy(x);
}
}
gwlist_destroy(l, NULL);