*** empty log message ***
This commit is contained in:
parent
f654396ea5
commit
d63cc82ea8
|
@ -907,10 +907,10 @@ static void pgq_queue_run(char *dir,
|
||||||
info(0, "pgsql_queue: Queue runner on [%s] shutdown, started...", dir);
|
info(0, "pgsql_queue: Queue runner on [%s] shutdown, started...", dir);
|
||||||
gwlist_remove_producer(items_list);
|
gwlist_remove_producer(items_list);
|
||||||
|
|
||||||
|
#if 0
|
||||||
for (i=0;i<num_threads; i++)
|
for (i=0;i<num_threads; i++)
|
||||||
gwthread_cancel(th_ids[i]);
|
gwthread_cancel(th_ids[i]);
|
||||||
|
#endif
|
||||||
for (i=0;i<num_threads; i++)
|
for (i=0;i<num_threads; i++)
|
||||||
gwthread_join(th_ids[i]);
|
gwthread_join(th_ids[i]);
|
||||||
|
|
||||||
|
|
|
@ -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 */
|
octstr_compare(y, cloc) == 0)) /* XXX seems wrong, but some MMC out there behave badly, so we support it */
|
||||||
c = mime_entity_duplicate(x);
|
c = mime_entity_duplicate(x);
|
||||||
|
|
||||||
if (y)
|
octstr_destroy(y);
|
||||||
octstr_destroy(y);
|
|
||||||
http_destroy_headers(headers);
|
http_destroy_headers(headers);
|
||||||
mime_entity_destroy(x);
|
mime_entity_destroy(x);
|
||||||
if (c)
|
if (c)
|
||||||
|
|
|
@ -1007,6 +1007,7 @@ static MmsMsg *mms_queue_getdata(MmsEnvelope *e)
|
||||||
struct Qthread_t {
|
struct Qthread_t {
|
||||||
List *l;
|
List *l;
|
||||||
int (*deliver)(MmsEnvelope *e);
|
int (*deliver)(MmsEnvelope *e);
|
||||||
|
long thid;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void tdeliver(struct Qthread_t *qt)
|
static void tdeliver(struct Qthread_t *qt)
|
||||||
|
@ -1122,7 +1123,7 @@ static void mms_queue_run(char *dir,
|
||||||
tlist[i].l = gwlist_create();
|
tlist[i].l = gwlist_create();
|
||||||
gwlist_add_producer(tlist[i].l);
|
gwlist_add_producer(tlist[i].l);
|
||||||
tlist[i].deliver = deliver;
|
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);
|
gwthread_sleep(sleepsecs);
|
||||||
} while (!qstop);
|
} while (!qstop);
|
||||||
|
|
||||||
|
info(0, "Queue runner [%s] goes down...", dir);
|
||||||
/* We are out of the queue, time to go away. */
|
/* We are out of the queue, time to go away. */
|
||||||
for (i = 0; i<num_threads; i++)
|
for (i = 0; i<num_threads; i++)
|
||||||
if (tlist[i].l)
|
if (tlist[i].l)
|
||||||
gwlist_remove_producer(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++)
|
for (i = 0; i<num_threads; i++)
|
||||||
if (tlist[i].l)
|
if (tlist[i].l)
|
||||||
gwlist_destroy(tlist[i].l,NULL); /* Final destroy if needed. */
|
gwlist_destroy(tlist[i].l,NULL); /* Final destroy if needed. */
|
||||||
gw_free(tlist);
|
gw_free(tlist);
|
||||||
|
|
||||||
|
|
||||||
gwlist_destroy(stack, (gwlist_item_destructor_t *)octstr_destroy);
|
gwlist_destroy(stack, (gwlist_item_destructor_t *)octstr_destroy);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ static MmsUaProfile *profile_fetch(Octstr *profile_url)
|
||||||
} else
|
} else
|
||||||
prof = NULL;
|
prof = NULL;
|
||||||
|
|
||||||
if (body) octstr_destroy(body);
|
octstr_destroy(body);
|
||||||
|
|
||||||
if (h) http_destroy_headers(h);
|
if (h) http_destroy_headers(h);
|
||||||
if (rh) http_destroy_headers(rh);
|
if (rh) http_destroy_headers(rh);
|
||||||
|
@ -492,7 +492,6 @@ int mms_start_profile_engine(char *cache_dir)
|
||||||
(void (*)(void *))destroy_uaprof);
|
(void (*)(void *))destroy_uaprof);
|
||||||
init_format_table();
|
init_format_table();
|
||||||
mms_load_ua_profile_cache(cache_dir);
|
mms_load_ua_profile_cache(cache_dir);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -500,9 +499,11 @@ int mms_start_profile_engine(char *cache_dir)
|
||||||
int mms_stop_profile_engine(void)
|
int mms_stop_profile_engine(void)
|
||||||
{
|
{
|
||||||
/* This will cause thread to stop and also destroy dict. */
|
/* 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);
|
dict_destroy(profile_dict);
|
||||||
|
|
||||||
profile_dict = NULL;
|
profile_dict = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -619,12 +619,17 @@ int main(int argc, char *argv[])
|
||||||
mmsbox_service_dispatch,
|
mmsbox_service_dispatch,
|
||||||
queue_interval, maxthreads, &rstop);
|
queue_interval, maxthreads, &rstop);
|
||||||
|
|
||||||
|
info(0, "Shutdown started..");
|
||||||
|
|
||||||
|
mmsbox_cleanup_settings();
|
||||||
|
sleep(2);
|
||||||
/* Wait for the sender thread, then quit. */
|
/* Wait for the sender thread, then quit. */
|
||||||
gwthread_join(qthread); /* Wait for it to die... */
|
gwthread_join(qthread); /* Wait for it to die... */
|
||||||
|
|
||||||
if (sendmms_port.port > 0)
|
if (sendmms_port.port > 0)
|
||||||
gwthread_join(sthread);
|
gwthread_join(sthread);
|
||||||
sleep(2);
|
info(0, "Shutdown complete..");
|
||||||
|
|
||||||
mms_lib_shutdown();
|
mms_lib_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -579,7 +579,7 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
||||||
return 0;
|
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. */
|
/* eventually we will destroy the object. For now, we only cleanup queue module. */
|
||||||
if (qfs)
|
if (qfs)
|
||||||
|
|
|
@ -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,
|
extern Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m,
|
||||||
Octstr **mmc_id);
|
Octstr **mmc_id);
|
||||||
extern void mmsbox_cleanup_mmsc_settings(void);
|
extern void mmsbox_cleanup_settings(void);
|
||||||
|
|
||||||
typedef struct MmsBoxHTTPClientInfo {
|
typedef struct MmsBoxHTTPClientInfo {
|
||||||
HTTPClient *client;
|
HTTPClient *client;
|
||||||
|
|
|
@ -449,7 +449,7 @@ static void cdr_thread(void *unused)
|
||||||
|
|
||||||
void mbuni_global_queue_runner(int *rstop)
|
void mbuni_global_queue_runner(int *rstop)
|
||||||
{
|
{
|
||||||
|
long cdr_thid;
|
||||||
mms_setmobile_queuedir(octstr_get_cstr(settings->mm1_queuedir));
|
mms_setmobile_queuedir(octstr_get_cstr(settings->mm1_queuedir));
|
||||||
|
|
||||||
mms_setsendmail_cmd(octstr_get_cstr(settings->sendmail));
|
mms_setsendmail_cmd(octstr_get_cstr(settings->sendmail));
|
||||||
|
@ -460,14 +460,16 @@ void mbuni_global_queue_runner(int *rstop)
|
||||||
/* Start the thread for CDR */
|
/* Start the thread for CDR */
|
||||||
cdr_list = gwlist_create();
|
cdr_list = gwlist_create();
|
||||||
gwlist_add_producer(cdr_list);
|
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);
|
settings->qfs->mms_queue_run(qdir, sendMsg, settings->queue_interval, settings->maxthreads, rstop);
|
||||||
/* When it ends, wait a little for other stuff to stop... */
|
/* When it ends, wait a little for other stuff to stop... */
|
||||||
sleep(2);
|
|
||||||
gwlist_remove_producer(cdr_list); /* Stop CDR thread. */
|
gwlist_remove_producer(cdr_list); /* Stop CDR thread. */
|
||||||
|
|
||||||
|
if (cdr_thid >= 0)
|
||||||
|
gwthread_join(cdr_thid);
|
||||||
|
sleep(2);
|
||||||
gwlist_destroy(cdr_list, NULL);
|
gwlist_destroy(cdr_list, NULL);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -241,9 +241,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (mm7_thread >= 0)
|
if (mm7_thread >= 0)
|
||||||
gwthread_join(mm7_thread);
|
gwthread_join(mm7_thread);
|
||||||
debug("proxy", 0, "Closed mm7 thread");
|
|
||||||
mms_lib_shutdown();
|
|
||||||
info(0, "mmsproxy: Shutdown complete");
|
info(0, "mmsproxy: Shutdown complete");
|
||||||
|
mms_lib_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ int main(int argc, char *argv[])
|
||||||
info(0, "Starting Local Queue Runner...");
|
info(0, "Starting Local Queue Runner...");
|
||||||
mbuni_mm1_queue_runner(&rstop);
|
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... */
|
/* It terminates, so start dying... */
|
||||||
info(0, "Stopping profile engine...");
|
info(0, "Stopping profile engine...");
|
||||||
|
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
sleep(2); /* Wait for them to die. */
|
sleep(2); /* Wait for them to die. */
|
||||||
info(0, "Final cleanup...");
|
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...");
|
info(0, "Queue runners shutdown, cleanup commenced...");
|
||||||
gwthread_join(qthread); /* Wait for it to die... */
|
gwthread_join(qthread); /* Wait for it to die... */
|
||||||
|
|
Loading…
Reference in New Issue