X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Feventclient%2Fserv_eventclient.c;h=05f8e6f1c298d679af96fe4e81b1a40353485cdf;hb=67d954e97ccee1cd9c9ae8a969eece1383a04d46;hp=6f95a6cf06019a6fc43af601ea93b41ad848bedc;hpb=4ce1695b8f1f04cdbfb0af09b902859259d9918d;p=citadel.git diff --git a/citadel/modules/eventclient/serv_eventclient.c b/citadel/modules/eventclient/serv_eventclient.c index 6f95a6cf0..05f8e6f1c 100644 --- a/citadel/modules/eventclient/serv_eventclient.c +++ b/citadel/modules/eventclient/serv_eventclient.c @@ -144,7 +144,7 @@ gotstatus(evcurl_global_data *global, int nnrun) FreeStrBuf(&IO->HttpReq.ReplyData); FreeURL(&IO->ConnectMe); RemoveContext(IO->CitContext); - free(IO); + IO->Terminate(IO); } } } @@ -272,7 +272,8 @@ void curl_init_connectionpool(void) int evcurl_init(AsyncIO *IO, void *CustomData, const char* Desc, - IO_CallBack CallBack) + IO_CallBack CallBack, + IO_CallBack Terminate) { CURLcode sta; CURL *chnd; @@ -280,6 +281,7 @@ int evcurl_init(AsyncIO *IO, CtdlLogPrintf(CTDL_DEBUG,"EVCURL: evcurl_init called ms\n"); IO->HttpReq.attached = 0; IO->SendDone = CallBack; + IO->Terminate = Terminate; chnd = IO->HttpReq.chnd = curl_easy_init(); if (!chnd) { @@ -477,7 +479,7 @@ void *client_event_thread(void *arg) ev_run (event_base, 0); - CtdlClearSystemContext(); +///what todo here? CtdlClearSystemContext(); ev_loop_destroy (EV_DEFAULT_UC); DeleteHash(&QueueEvents); @@ -505,6 +507,8 @@ HashList *DBInboundEventQueues[2] = { NULL, NULL }; ev_async DBAddJob; ev_async DBExitEventLoop; +extern void ShutDownDBCLient(AsyncIO *IO); + static void DBQueueEventAddCallback(EV_P_ ev_async *w, int revents) { HashList *q; @@ -530,7 +534,15 @@ static void DBQueueEventAddCallback(EV_P_ ev_async *w, int revents) while (GetNextHashPos(q, It, &len, &Key, &v)) { IOAddHandler *h = v; - h->EvAttch(h->IO); + eNextState rc; + rc = h->EvAttch(h->IO); + switch (rc) + { + case eAbort: + ShutDownDBCLient(h->IO); + default: + break; + } } DeleteHashPos(&It); DeleteHashContent(&q); @@ -540,9 +552,8 @@ static void DBQueueEventAddCallback(EV_P_ ev_async *w, int revents) static void DBEventExitCallback(EV_P_ ev_async *w, int revents) { - ev_break(event_db, EVBREAK_ALL); - CtdlLogPrintf(CTDL_DEBUG, "EVENT Q exiting.\n"); + ev_break(event_db, EVBREAK_ALL); } @@ -590,7 +601,7 @@ void *db_event_thread(void *arg) ev_run (event_db, 0); - CtdlClearSystemContext(); +//// what to do here? CtdlClearSystemContext(); ev_loop_destroy (event_db); DeleteHash(&DBQueueEvents);