X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Feventclient%2Fserv_eventclient.c;h=f2fbef00a6d93bab1b9d43e9e3ddb1bc6f2ffb04;hb=75b5384185328d4e7be3c29d5f9527a39aede0dd;hp=873d1662852a664401a557b1607d05c957493e2c;hpb=c67fb1c41bfc35b3449e4c52cf903fdba3cdb776;p=citadel.git diff --git a/citadel/modules/eventclient/serv_eventclient.c b/citadel/modules/eventclient/serv_eventclient.c index 873d16628..f2fbef00a 100644 --- a/citadel/modules/eventclient/serv_eventclient.c +++ b/citadel/modules/eventclient/serv_eventclient.c @@ -153,9 +153,15 @@ gotstatus(evcurl_global_data *global, int nnrun) msta = curl_multi_remove_handle(mhnd, chnd); if (msta) CtdlLogPrintf(CTDL_ERR, "EVCURL: warning problem detaching completed handle from curl multi: %s\n", curl_multi_strerror(msta)); + IO->HttpReq.attached = 0; IO->SendDone(IO); - curl_multi_cleanup(msta); + curl_easy_cleanup(IO->HttpReq.chnd); + curl_slist_free_all(IO->HttpReq.headers); + FreeStrBuf(&IO->HttpReq.ReplyData); + FreeURL(&IO->ConnectMe); + RemoveContext(IO->CitContext); + free(IO); } } } @@ -235,6 +241,7 @@ gotwatchsock(CURL *easy, curl_socket_t fd, int action, void *cglobal, void *csoc } if (CURL_POLL_REMOVE == action) { CtdlLogPrintf(CTDL_ERR,"EVCURL: called last time to unregister this sockwatcher\n"); + ev_io_stop(event_base, &sockwatcher->ioev); free(sockwatcher); } else { int events = (action & CURL_POLL_IN ? EV_READ : 0) | (action & CURL_POLL_OUT ? EV_WRITE : 0); @@ -383,6 +390,10 @@ static void WakeupCurlCallback(EV_P_ ev_async *w, int revents) curl_multi_perform(&global, CURL_POLL_NONE); } +static void evcurl_shutdown (void) +{ + curl_multi_cleanup(global.mhnd); +} /***************************************************************************** * libevent integration * *****************************************************************************/ @@ -484,7 +495,7 @@ void *client_event_thread(void *arg) DeleteHash(&InboundEventQueues[0]); DeleteHash(&InboundEventQueues[1]); citthread_mutex_destroy(&EventQueueMutex); - + evcurl_shutdown(); return(NULL); }