}
}
-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,
eNextState QueueEventContext(AsyncIO *IO, IO_CallBack CB);
eNextState QueueCurlContext(AsyncIO *IO);
-eNextState InitEventIO(AsyncIO *IO,
- void *pData,
- double conn_timeout,
- double first_rw_timeout,
- int ReadFirst);
+eNextState EvConnectSock(AsyncIO *IO,
+ void *pData,
+ double conn_timeout,
+ double first_rw_timeout,
+ int ReadFirst);
void IO_postdns_callback(struct ev_loop *loop, ev_idle *watcher, int revents);
int QueueQuery(ns_type Type, const char *name, AsyncIO *IO, DNSQueryParts *QueryParts, IO_CallBack PostDNS);
ChrPtr(NW->host),
ChrPtr(NW->port));
- return InitEventIO(IO, NW,
- NWC_ConnTimeout,
- NWC_ReadTimeouts[0],
- 1);
+ return EvConnectSock(IO, NW,
+ NWC_ConnTimeout,
+ NWC_ReadTimeouts[0],
+ 1);
}
void RunNetworker(AsyncNetworker *NW)
/////// SetConnectStatus(IO);
- return InitEventIO(IO, cpptr,
- POP3_C_ConnTimeout,
- POP3_C_ReadTimeouts[0],
- 1);
+ return EvConnectSock(IO, cpptr,
+ POP3_C_ConnTimeout,
+ POP3_C_ReadTimeouts[0],
+ 1);
}
eNextState pop3_get_one_host_ip_done(AsyncIO *IO)
SetConnectStatus(IO);
- return InitEventIO(IO, SendMsg,
- SMTP_C_ConnTimeout,
- SMTP_C_ReadTimeouts[0],
- 1);
+ return EvConnectSock(IO, SendMsg,
+ SMTP_C_ConnTimeout,
+ SMTP_C_ReadTimeouts[0],
+ 1);
}
eNextState get_one_mx_host_ip_done(AsyncIO *IO)