Assert that we don't always have a valid session.
[citadel.git] / citadel / event_client.h
index 8777a34333d9509c2a30f7a134d1c30fb3530ff2..66976a8aded74ce1fc8aa1a120976007579c26ca 100644 (file)
@@ -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,7 +285,6 @@ 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, int CloseFDs);
 void StopDBWatchers(AsyncIO *IO);
 eNextState QueueEventContext(AsyncIO *IO, IO_CallBack CB);
@@ -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,