tblock_ms = 14000;
ev_timer_set(&global->timeev, 0.5e-3 + 1.0e-3 * tblock_ms, 14.0);
ev_timer_start(EV_DEFAULT_UC, &global->timeev);
- curl_multi_perform(global, CURL_POLL_NONE);
+ curl_multi_perform(global, &global->nrun);
return 0;
}
OPT(VERBOSE, (long)1);
/* unset in production */
- OPT(NOPROGRESS, (long)1);
- OPT(NOSIGNAL, (long)1);
+ OPT(NOPROGRESS, 1L);
+ OPT(NOSIGNAL, 1L);
OPT(FAILONERROR, (long)1);
OPT(ENCODING, "");
- OPT(FOLLOWLOCATION, (long)1);
- OPT(MAXREDIRS, (long)7);
+ OPT(FOLLOWLOCATION, (long)0);
+ OPT(MAXREDIRS, (long)0);
OPT(USERAGENT, CITADEL);
OPT(TIMEOUT, (long)1800);
static void evcurl_shutdown (void)
{
+ curl_global_cleanup();
curl_multi_cleanup(global.mhnd);
+ syslog(LOG_DEBUG, "client_event_thread() initializing\n");
}
/*****************************************************************************
* libevent integration *
CtdlFillSystemContext(&libev_client_CC, "LibEv Thread");
// citthread_setspecific(MyConKey, (void *)&smtp_queue_CC);
- syslog(LOG_DEBUG, "client_ev_thread() initializing\n");
+ syslog(LOG_DEBUG, "client_event_thread() initializing\n");
event_base = ev_default_loop (EVFLAG_AUTO);
ev_async_init(&AddJob, QueueEventAddCallback);
ev_run (event_base, 0);
+ syslog(LOG_DEBUG, "client_event_thread() exiting\n");
///what todo here? CtdlClearSystemContext();
ev_loop_destroy (EV_DEFAULT_UC);
- curl_global_cleanup();
- curl_multi_cleanup(global.mhnd);
DeleteHash(&QueueEvents);
InboundEventQueue = NULL;
DeleteHash(&InboundEventQueues[0]);
static void DBEventExitCallback(EV_P_ ev_async *w, int revents)
{
- syslog(LOG_DEBUG, "EVENT Q exiting.\n");
+ syslog(LOG_DEBUG, "DB EVENT Q exiting.\n");
ev_break(event_db, EVBREAK_ALL);
}
CtdlFillSystemContext(&libev_msg_CC, "LibEv DB IO Thread");
// citthread_setspecific(MyConKey, (void *)&smtp_queue_CC);
- syslog(LOG_DEBUG, "client_msgev_thread() initializing\n");
+ syslog(LOG_DEBUG, "dbevent_thread() initializing\n");
event_db = ev_loop_new (EVFLAG_AUTO);
ev_run (event_db, 0);
+ syslog(LOG_DEBUG, "dbevent_thread() exiting\n");
//// what to do here? CtdlClearSystemContext();
ev_loop_destroy (event_db);
return(NULL);
}
+void ShutDownEventQueues(void)
+{
+ syslog(LOG_DEBUG, "EVENT Qs triggering exits.\n");
+
+ pthread_mutex_lock(&DBEventQueueMutex);
+ ev_async_send (event_db, &DBExitEventLoop);
+ pthread_mutex_unlock(&DBEventQueueMutex);
+
+ pthread_mutex_lock(&EventQueueMutex);
+ ev_async_send (EV_DEFAULT_ &ExitEventLoop);
+ pthread_mutex_unlock(&EventQueueMutex);
+}
+
CTDL_MODULE_INIT(event_client)
{
if (!threading)
{
+ CtdlRegisterCleanupHook(ShutDownEventQueues);
InitEventQueue();
DBInitEventQueue();
CtdlThreadCreate(/*"Client event", */ client_event_thread);