X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fextnotify%2Fextnotify_main.c;h=c649587f9a405a2ea34bbfeb8a627f65352092c6;hb=e4a11960ed242bc53c90f6fde598bf301ece6f8a;hp=1734d088d30013283df8571c74db113c568063c4;hpb=d75ab6a3ad9760b378adb119aee679f3aa18cd06;p=citadel.git diff --git a/citadel/modules/extnotify/extnotify_main.c b/citadel/modules/extnotify/extnotify_main.c index 1734d088d..c649587f9 100644 --- a/citadel/modules/extnotify/extnotify_main.c +++ b/citadel/modules/extnotify/extnotify_main.c @@ -161,9 +161,11 @@ void create_extnotify_queue(void) { */ void do_extnotify_queue(void) { + NotifyContext Ctx; static int doing_queue = 0; int i = 0; + CitContext extnotifyCC; /* * This is a simple concurrency check to make sure only one queue run @@ -173,6 +175,10 @@ void do_extnotify_queue(void) */ if (doing_queue) return; doing_queue = 1; + + /* Give this thread its own private CitContext */ + CtdlFillSystemContext(&extnotifyCC, "extnotify"); + citthread_setspecific(MyConKey, (void *)&extnotifyCC ); /* * Go ahead and run the queue @@ -183,6 +189,7 @@ void do_extnotify_queue(void) Ctx.NotifyHostList = GetNotifyHosts(); if (CtdlGetRoom(&CC->room, FNBL_QUEUE_ROOM) != 0) { CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM); + CtdlClearSystemContext(); return; } CtdlForEachMessage(MSGS_ALL, 0L, NULL, @@ -213,6 +220,7 @@ void do_extnotify_queue(void) CtdlLogPrintf(CTDL_DEBUG, "serv_extnotify: queue run completed\n"); doing_queue = 0; + CtdlClearSystemContext(); } /*! * \brief Process messages in the external notification queue