/*
- * Copyright (c) 1998-2009 by the citadel.org team
+ * Copyright (c) 1998-2012 by the citadel.org team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * This program is open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3.
+ *
+ *
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ *
*/
#include "sysdep.h"
curl_easy_strerror(sta));
IO = (AsyncIO *)chandle;
+ IO->Now = ev_now(event_base);
+
ev_io_stop(event_base, &IO->recv_event);
ev_io_stop(event_base, &IO->send_event);
{
IO->HttpReq.ReplyData = NewStrBufPlain(NULL, SIZ);
}
+ IO->Now = ev_now(event_base);
return CurlFillStrBuf_callback(data,
size,
nmemb,
curl_multi_assign(mhnd, fd, IO);
}
+ IO->Now = ev_now(event_base);
+
Action = "";
switch (action)
{
{
CURLMcode msta;
AsyncIO *IO = watcher->data;
+ IO->Now = ev_now(event_base);
EV_syslog(LOG_DEBUG, "EVENT Curl: %s\n", __FUNCTION__);
curl_slist_free_all(IO->HttpReq.headers);
static void QueueEventAddCallback(EV_P_ ev_async *w, int revents)
{
+ ev_tstamp Now;
HashList *q;
void *v;
HashPos*It;
q = InboundEventQueues[1];
}
pthread_mutex_unlock(&EventQueueMutex);
-
+ Now = ev_now (event_base);
It = GetNewHashPos(q, 0);
while (GetNextHashPos(q, It, &len, &Key, &v))
{
IOAddHandler *h = v;
- if (h->IO->ID == 0)
+ if (h->IO->ID == 0) {
h->IO->ID = EvIDSource++;
+ }
+ if (h->IO->StartIO == 0.0)
+ h->IO->StartIO = Now;
+ h->IO->Now = Now;
h->EvAttch(h->IO);
}
DeleteHashPos(&It);
InboundEventQueues[1] = NewHash(1, Flathash);
InboundEventQueue = InboundEventQueues[0];
}
+extern void CtdlDestroyEVCleanupHooks(void);
+extern int EVQShutDown;
/*
* this thread operates the select() etc. via libev.
*/
close(event_add_pipe[0]);
close(event_add_pipe[1]);
+ CtdlDestroyEVCleanupHooks();
+
+ EVQShutDown = 1;
return(NULL);
}
static void DBQueueEventAddCallback(EV_P_ ev_async *w, int revents)
{
+ ev_tstamp Now;
HashList *q;
void *v;
HashPos *It;
}
pthread_mutex_unlock(&DBEventQueueMutex);
+ Now = ev_now (event_db);
It = GetNewHashPos(q, 0);
while (GetNextHashPos(q, It, &len, &Key, &v))
{
eNextState rc;
if (h->IO->ID == 0)
h->IO->ID = EvIDSource++;
+ if (h->IO->StartDB == 0.0)
+ h->IO->StartDB = Now;
+ h->IO->Now = Now;
rc = h->EvAttch(h->IO);
switch (rc)
{
{
if (!threading)
{
- CtdlRegisterCleanupHook(ShutDownEventQueues);
InitEventQueue();
DBInitEventQueue();
CtdlThreadCreate(client_event_thread);