X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fevent_client.c;h=78876b50271296bb19196de5033537dd70113412;hb=3228daa54e93fe68aeb0e08a428795fa6dcc0d28;hp=fdd66d7ae6c17a1d47d066e5121c87b587c5cee3;hpb=9563ce7303d1d0d20b963d643f9afc06b53c8e4d;p=citadel.git diff --git a/citadel/event_client.c b/citadel/event_client.c index fdd66d7ae..78876b502 100644 --- a/citadel/event_client.c +++ b/citadel/event_client.c @@ -101,7 +101,8 @@ void SetEVState(AsyncIO *IO, eIOState State) { CitContext* CCC = IO->CitContext; - memcpy(CCC->lastcmdname, IOStates[State].Key, IOStates[State].len + 1); + if (CCC != NULL) + memcpy(CCC->lastcmdname, IOStates[State].Key, IOStates[State].len + 1); } @@ -294,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) @@ -333,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) { @@ -384,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); }