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> 2009-01-12 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fixes: Output from admin interfaces always valid XML * Minor fixes: Output from admin interfaces always valid XML
* Minor fixes: admin module
2008-12-24 P. A. Bagyenda <bagyenda@dsmagic.com> 2008-12-24 P. A. Bagyenda <bagyenda@dsmagic.com>
* Improved MM1 performance * Improved MM1 performance
2008-12-17 P. A. Bagyenda <bagyenda@dsmagic.com> 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; MmscGrp *mmc;
int n = gwlist_len(mmsc_del_list); int n = gwlist_len(mmsc_del_list);
while (n-- > 0 && while (n-- > 0 && mmsc_del_list &&
(mmc = gwlist_extract_first(mmsc_del_list)) != NULL) (mmc = gwlist_extract_first(mmsc_del_list)) != NULL)
if (delete_all || if (delete_all ||
(mmc->use_count <= 0 && (mmc->use_count <= 0 &&
@ -707,13 +707,14 @@ void mmsbox_stop_all_mmsc_conn(void)
Octstr *mmc; Octstr *mmc;
List *l = dict_keys(mmscs); List *l = dict_keys(mmscs);
while ((mmc = gwlist_extract_first(l)) != NULL) { if (l) {
mms_info(0, "mmsbox", NULL,"Stopping MMSC [%s]", octstr_get_cstr(mmc)); while ((mmc = gwlist_extract_first(l)) != NULL) {
mmsbox_stop_mmsc_conn(mmc); mms_info(0, "mmsbox", NULL,"Stopping MMSC [%s]", octstr_get_cstr(mmc));
octstr_destroy(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. */ /* Get the MMC that should handler this recipient. */
@ -1014,27 +1015,27 @@ static void admin_handler(void *unused)
gwlist_append(l, m); gwlist_append(l, m);
} }
/* Start MMSCs. */ /* Start MMSCs. */
if (l)
while ((m = gwlist_extract_first(l)) != NULL) { while ((m = gwlist_extract_first(l)) != NULL) {
List *e = gwlist_create(); List *e = gwlist_create();
List *w = gwlist_create(); List *w = gwlist_create();
Octstr *x; Octstr *x;
MmscGrp *mc = start_mmsc_from_conf(cfg, m, mmsc_receiver_func, e, w); MmscGrp *mc = start_mmsc_from_conf(cfg, m, mmsc_receiver_func, e, w);
if (mc != NULL) if (mc != NULL)
append_mmsc_status(rbody, mc, w); append_mmsc_status(rbody, mc, w);
else if (gwlist_len(e) > 0) else if (gwlist_len(e) > 0)
while ((x = gwlist_extract_first(e)) != NULL) { while ((x = gwlist_extract_first(e)) != NULL) {
octstr_format_append(rbody, octstr_format_append(rbody,
"<Start-Mmsc><Error>%S</Error></Start-Mmsc>\n", "<Start-Mmsc><Error>%S</Error></Start-Mmsc>\n",
x); x);
octstr_destroy(x); octstr_destroy(x);
} }
gwlist_destroy(e, (void *)octstr_destroy); gwlist_destroy(e, (void *)octstr_destroy);
gwlist_destroy(w, (void *)octstr_destroy); gwlist_destroy(w, (void *)octstr_destroy);
mms_cfg_destroy_grp(cfg, m); mms_cfg_destroy_grp(cfg, m);
} }
} else if (octstr_str_case_compare(url, "/stop") == 0) { } else if (octstr_str_case_compare(url, "/stop") == 0) {
Octstr *x; Octstr *x;
if (mmc_id == NULL) if (mmc_id == NULL)
@ -1044,13 +1045,14 @@ static void admin_handler(void *unused)
gwlist_append(l, octstr_duplicate(mmc_id)); gwlist_append(l, octstr_duplicate(mmc_id));
} }
while ((x = gwlist_extract_first(l)) != NULL) { if (l)
int ret = mmsbox_stop_mmsc_conn(x); while ((x = gwlist_extract_first(l)) != NULL) {
octstr_format_append(rbody, int ret = mmsbox_stop_mmsc_conn(x);
"<Stop-Mmsc><%s/></Stop-Mmsc>\n", octstr_format_append(rbody,
ret == 0 ? "Success" : "Failed"); "<Stop-Mmsc><%s/></Stop-Mmsc>\n",
octstr_destroy(x); ret == 0 ? "Success" : "Failed");
} octstr_destroy(x);
}
} else if (octstr_str_case_compare(url, "/status") == 0) { } else if (octstr_str_case_compare(url, "/status") == 0) {
Octstr *x; Octstr *x;
@ -1061,12 +1063,13 @@ static void admin_handler(void *unused)
l = gwlist_create(); l = gwlist_create();
gwlist_append(l, octstr_duplicate(mmc_id)); gwlist_append(l, octstr_duplicate(mmc_id));
} }
while ((x = gwlist_extract_first(l)) != NULL) { if (l)
if ((mc = dict_get(mmscs, x)) != NULL) while ((x = gwlist_extract_first(l)) != NULL) {
append_mmsc_status(rbody, mc, NULL); if ((mc = dict_get(mmscs, x)) != NULL)
octstr_destroy(x); append_mmsc_status(rbody, mc, NULL);
} octstr_destroy(x);
}
} }
gwlist_destroy(l, NULL); gwlist_destroy(l, NULL);