1
0
Fork 0

*** empty log message ***

This commit is contained in:
bagyenda 2008-07-19 01:08:40 +00:00
parent f654396ea5
commit d63cc82ea8
10 changed files with 35 additions and 21 deletions

View File

@ -907,10 +907,10 @@ static void pgq_queue_run(char *dir,
info(0, "pgsql_queue: Queue runner on [%s] shutdown, started...", dir);
gwlist_remove_producer(items_list);
#if 0
for (i=0;i<num_threads; i++)
gwthread_cancel(th_ids[i]);
#endif
for (i=0;i<num_threads; i++)
gwthread_join(th_ids[i]);

View File

@ -315,8 +315,7 @@ MSoapMsg_t *mm7_parse_soap(List *headers, Octstr *body)
octstr_compare(y, cloc) == 0)) /* XXX seems wrong, but some MMC out there behave badly, so we support it */
c = mime_entity_duplicate(x);
if (y)
octstr_destroy(y);
octstr_destroy(y);
http_destroy_headers(headers);
mime_entity_destroy(x);
if (c)

View File

@ -1007,6 +1007,7 @@ static MmsMsg *mms_queue_getdata(MmsEnvelope *e)
struct Qthread_t {
List *l;
int (*deliver)(MmsEnvelope *e);
long thid;
};
static void tdeliver(struct Qthread_t *qt)
@ -1122,7 +1123,7 @@ static void mms_queue_run(char *dir,
tlist[i].l = gwlist_create();
gwlist_add_producer(tlist[i].l);
tlist[i].deliver = deliver;
gwthread_create((gwthread_func_t *)tdeliver, &tlist[i]);
tlist[i].thid = gwthread_create((gwthread_func_t *)tdeliver, &tlist[i]);
}
@ -1151,18 +1152,25 @@ static void mms_queue_run(char *dir,
gwthread_sleep(sleepsecs);
} while (!qstop);
info(0, "Queue runner [%s] goes down...", dir);
/* We are out of the queue, time to go away. */
for (i = 0; i<num_threads; i++)
if (tlist[i].l)
gwlist_remove_producer(tlist[i].l);
gwthread_join_every((gwthread_func_t *)tdeliver); /* Wait for them all to terminate. */
for (i = 0; i<num_threads; i++) /* Wait for them all to terminate. */
if (tlist[i].thid >= 0)
gwthread_join(tlist[i].thid);
for (i = 0; i<num_threads; i++)
if (tlist[i].l)
gwlist_destroy(tlist[i].l,NULL); /* Final destroy if needed. */
gw_free(tlist);
gwlist_destroy(stack, (gwlist_item_destructor_t *)octstr_destroy);
return;
}

View File

@ -470,7 +470,7 @@ static MmsUaProfile *profile_fetch(Octstr *profile_url)
} else
prof = NULL;
if (body) octstr_destroy(body);
octstr_destroy(body);
if (h) http_destroy_headers(h);
if (rh) http_destroy_headers(rh);
@ -492,7 +492,6 @@ int mms_start_profile_engine(char *cache_dir)
(void (*)(void *))destroy_uaprof);
init_format_table();
mms_load_ua_profile_cache(cache_dir);
return 0;
}
@ -500,9 +499,11 @@ int mms_start_profile_engine(char *cache_dir)
int mms_stop_profile_engine(void)
{
/* This will cause thread to stop and also destroy dict. */
if (profile_dir)
octstr_destroy(profile_dir);
octstr_destroy(profile_dir);
dict_destroy(profile_dict);
profile_dict = NULL;
return 0;
}

View File

@ -619,12 +619,17 @@ int main(int argc, char *argv[])
mmsbox_service_dispatch,
queue_interval, maxthreads, &rstop);
info(0, "Shutdown started..");
mmsbox_cleanup_settings();
sleep(2);
/* Wait for the sender thread, then quit. */
gwthread_join(qthread); /* Wait for it to die... */
if (sendmms_port.port > 0)
gwthread_join(sthread);
sleep(2);
info(0, "Shutdown complete..");
mms_lib_shutdown();
return 0;
}

View File

@ -579,7 +579,7 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
return 0;
}
void mmsbox_cleanup_mmsc_settings(void)
void mmsbox_cleanup_settings(void)
{
/* eventually we will destroy the object. For now, we only cleanup queue module. */
if (qfs)

View File

@ -118,7 +118,7 @@ extern MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from);
extern Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
Octstr **mmc_id);
extern void mmsbox_cleanup_mmsc_settings(void);
extern void mmsbox_cleanup_settings(void);
typedef struct MmsBoxHTTPClientInfo {
HTTPClient *client;

View File

@ -449,7 +449,7 @@ static void cdr_thread(void *unused)
void mbuni_global_queue_runner(int *rstop)
{
long cdr_thid;
mms_setmobile_queuedir(octstr_get_cstr(settings->mm1_queuedir));
mms_setsendmail_cmd(octstr_get_cstr(settings->sendmail));
@ -460,14 +460,16 @@ void mbuni_global_queue_runner(int *rstop)
/* Start the thread for CDR */
cdr_list = gwlist_create();
gwlist_add_producer(cdr_list);
gwthread_create(cdr_thread, NULL);
cdr_thid = gwthread_create(cdr_thread, NULL);
settings->qfs->mms_queue_run(qdir, sendMsg, settings->queue_interval, settings->maxthreads, rstop);
/* When it ends, wait a little for other stuff to stop... */
sleep(2);
gwlist_remove_producer(cdr_list); /* Stop CDR thread. */
if (cdr_thid >= 0)
gwthread_join(cdr_thid);
sleep(2);
gwlist_destroy(cdr_list, NULL);
return;

View File

@ -241,9 +241,8 @@ int main(int argc, char *argv[])
if (mm7_thread >= 0)
gwthread_join(mm7_thread);
debug("proxy", 0, "Closed mm7 thread");
mms_lib_shutdown();
info(0, "mmsproxy: Shutdown complete");
mms_lib_shutdown();
return 0;
}

View File

@ -85,7 +85,7 @@ int main(int argc, char *argv[])
info(0, "Starting Local Queue Runner...");
mbuni_mm1_queue_runner(&rstop);
gwthread_cancel(qthread); /* force it to die if not yet dead. */
/* gwthread_cancel(qthread); force it to die if not yet dead. */
/* It terminates, so start dying... */
info(0, "Stopping profile engine...");
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
sleep(2); /* Wait for them to die. */
info(0, "Final cleanup...");
mms_cleanup_mmsc_settings(settings);
mms_cleanup_mmsc_settings(settings); /* Stop settings stuff and so on. */
info(0, "Queue runners shutdown, cleanup commenced...");
gwthread_join(qthread); /* Wait for it to die... */