X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fevent_client.h;h=66976a8aded74ce1fc8aa1a120976007579c26ca;hb=4c274aa94a53d8850ed363e64c5863970fe629a4;hp=a5e0c326f5e0b08a401b4020a5605eeda04bbc22;hpb=1493fd8ff0de73d30336607b43b1c8113ffcffa2;p=citadel.git diff --git a/citadel/event_client.h b/citadel/event_client.h index a5e0c326f..66976a8ad 100644 --- a/citadel/event_client.h +++ b/citadel/event_client.h @@ -153,6 +153,7 @@ typedef struct __evcares_data { IO_CallBack Fail; /* the dns lookup didn't work out. */ } evcares_data; + struct AsyncIO { long ID; ev_tstamp Now; @@ -193,7 +194,8 @@ struct AsyncIO { Timeout, /* Timeout handler;may also be conn. timeout */ ConnFail, /* What to do when one connection failed? */ ShutdownAbort,/* we're going down. make your piece. */ - NextDBOperation; /* Perform Database IO */ + NextDBOperation, /* Perform Database IO */ + ReAttachCB; /* on the hop from one Q to the other, this is the next CB */ /* if we have linereaders, maybe we want to read more lines before * the real application logic is called? */ @@ -219,6 +221,7 @@ typedef struct _IOAddHandler { } IOAddHandler; +inline static time_t EvGetNow(AsyncIO *IO) { return (time_t) IO->Now;} extern int DebugEventLoop; extern int DebugCAres; @@ -282,8 +285,7 @@ extern int DebugCAres; void FreeAsyncIOContents(AsyncIO *IO); eNextState NextDBOperation(AsyncIO *IO, IO_CallBack CB); -eNextState QueueDBOperation(AsyncIO *IO, IO_CallBack CB); -eNextState EventQueueDBOperation(AsyncIO *IO, IO_CallBack CB); +eNextState EventQueueDBOperation(AsyncIO *IO, IO_CallBack CB, int CloseFDs); void StopDBWatchers(AsyncIO *IO); eNextState QueueEventContext(AsyncIO *IO, IO_CallBack CB); eNextState QueueCurlContext(AsyncIO *IO); @@ -326,6 +328,10 @@ void SetNextTimeout(AsyncIO *IO, double timeout); curl_easy_strerror(sta)); \ } } while (0) +#define SET_EV_TIME(IO, BASE) \ + IO->Now = ev_now(BASE); \ + if (IO->CitContext != NULL) IO->CitContext->lastcmd = IO->Now; + void InitIOStruct(AsyncIO *IO, void *Data, eNextState NextState,