*
* Copyright (c) 1998-2009 by the citadel.org team
*
- * This program is free software; you can redistribute it and/or modify
+ * This program is open source 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.
return eSendReply;
}
-int ShutDownEventQueue(void)
-{
- 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);
- return 0;
-}
-
void FreeAsyncIOContents(AsyncIO *IO)
{
FreeStrBuf(&IO->IOBuf);
ev_cleanup_stop(event_base, &IO->abort_by_shutdown);
StopClientWatchers(IO);
- if (IO->DNSChannel != NULL) {
- ares_destroy(IO->DNSChannel);
- ev_io_stop(event_base, &IO->dns_recv_event);
- ev_io_stop(event_base, &IO->dns_send_event);
- IO->DNSChannel = NULL;
+ if (IO->DNS.Channel != NULL) {
+ ares_destroy(IO->DNS.Channel);
+ ev_io_stop(event_base, &IO->DNS.recv_event);
+ ev_io_stop(event_base, &IO->DNS.send_event);
+ IO->DNS.Channel = NULL;
}
assert(IO->Terminate);
IO->Terminate(IO);
AsyncIO *IO = watcher->data;
EV_syslog(LOG_DEBUG, "event: %s\n", __FUNCTION__);
become_session(IO->CitContext);
- assert(IO->DNSFail);
- assert(IO->DNSQuery->PostDNS);
- switch (IO->DNSQuery->PostDNS(IO))
+ assert(IO->DNS.Fail);
+ assert(IO->DNS.Query->PostDNS);
+ switch (IO->DNS.Query->PostDNS(IO))
{
case eAbort:
- switch (IO->DNSFail(IO)) {
+ switch (IO->DNS.Fail(IO)) {
case eAbort:
ShutDownCLient(IO);
default:
}
}
-eNextState event_connect_socket(AsyncIO *IO, double conn_timeout, double first_rw_timeout)
+
+eNextState EvConnectSock(AsyncIO *IO,
+ void *pData,
+ double conn_timeout,
+ double first_rw_timeout,
+ int ReadFirst)
{
int fdflags;
int rc = -1;
+ IO->Data = pData;
+ become_session(IO->CitContext);
+
+ if (ReadFirst) {
+ IO->NextState = eReadMessage;
+ }
+ else {
+ IO->NextState = eSendReply;
+ }
+
IO->SendBuf.fd = IO->RecvBuf.fd =
socket(
(IO->ConnectMe->IPv6)?PF_INET6:PF_INET,
ev_timer_again (event_base, &IO->rw_timeout);
}
-eNextState InitEventIO(AsyncIO *IO,
- void *pData,
- double conn_timeout,
- double first_rw_timeout,
- int ReadFirst)
-{
- IO->Data = pData;
- become_session(IO->CitContext);
-
- if (ReadFirst) {
- IO->NextState = eReadMessage;
- }
- else {
- IO->NextState = eSendReply;
- }
- return event_connect_socket(IO, conn_timeout, first_rw_timeout);
-}
eNextState ReAttachIO(AsyncIO *IO,
void *pData,