]> code.citadel.org Git - citadel.git/blobdiff - citadel/event_client.c
CURL: the cleanup has to be done before.
[citadel.git] / citadel / event_client.c
index 68995ddf7153401a26f8aa7222285959b33f16ca..78876b50271296bb19196de5033537dd70113412 100644 (file)
@@ -295,6 +295,17 @@ eNextState QueueEventContext(AsyncIO *IO, IO_CallBack CB)
        return eSendReply;
 }
 
+eNextState EventQueueDBOperation(AsyncIO *IO, IO_CallBack CB)
+{
+       StopClientWatchers(IO, 0);
+       return QueueDBOperation(IO, CB);
+}
+eNextState DBQueueEventContext(AsyncIO *IO, IO_CallBack CB)
+{
+       StopDBWatchers(IO);
+       return QueueEventContext(IO, CB);
+}
+
 extern eNextState evcurl_handle_start(AsyncIO *IO);
 
 eNextState QueueCurlContext(AsyncIO *IO)
@@ -334,6 +345,13 @@ eNextState QueueCurlContext(AsyncIO *IO)
        return eSendReply;
 }
 
+eNextState CurlQueueDBOperation(AsyncIO *IO, IO_CallBack CB)
+{
+       StopCurlWatchers(IO);
+       return QueueDBOperation(IO, CB);
+}
+
+
 void DestructCAres(AsyncIO *IO);
 void FreeAsyncIOContents(AsyncIO *IO)
 {
@@ -385,6 +403,9 @@ void StopCurlWatchers(AsyncIO *IO)
        ev_io_stop(event_base, &IO->send_event);
        ev_io_stop(event_base, &IO->recv_event);
 
+       curl_easy_cleanup(IO->HttpReq.chnd);
+       IO->HttpReq.chnd = NULL;
+
        if (IO->SendBuf.fd != 0) {
                close(IO->SendBuf.fd);
        }