From: Wilfried Goesgens Date: Sun, 25 Dec 2011 15:57:29 +0000 (+0100) Subject: rename InitEventIO to EvConnectSock, since this suits better what this function does... X-Git-Tag: v8.11~281 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=cf7cb2463d47a4a9ed36c8d1c13f188418389437;hp=5268c0a9bf8202336b9e3e8b86f45d9d010f2811 rename InitEventIO to EvConnectSock, since this suits better what this function does. Join it with ev_connect_sock --- diff --git a/citadel/event_client.c b/citadel/event_client.c index 27e8a8146..4a2f481a9 100644 --- a/citadel/event_client.c +++ b/citadel/event_client.c @@ -700,11 +700,26 @@ IO_postdns_callback(struct ev_loop *loop, ev_idle *watcher, int revents) } } -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, @@ -790,23 +805,6 @@ void SetNextTimeout(AsyncIO *IO, double timeout) 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, diff --git a/citadel/event_client.h b/citadel/event_client.h index 0b71c743e..c8a4bafe3 100644 --- a/citadel/event_client.h +++ b/citadel/event_client.h @@ -165,11 +165,11 @@ eNextState QueueDBOperation(AsyncIO *IO, IO_CallBack CB); 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); diff --git a/citadel/modules/network/serv_networkclient.c b/citadel/modules/network/serv_networkclient.c index 338425e76..d0e9e6d19 100644 --- a/citadel/modules/network/serv_networkclient.c +++ b/citadel/modules/network/serv_networkclient.c @@ -789,10 +789,10 @@ eNextState nwc_connect_ip(AsyncIO *IO) 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) diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index e20f16f70..8a0d23c38 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -766,10 +766,10 @@ eNextState pop3_connect_ip(AsyncIO *IO) /////// 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) diff --git a/citadel/modules/smtp/serv_smtpeventclient.c b/citadel/modules/smtp/serv_smtpeventclient.c index 8e0d09132..af5d12d94 100644 --- a/citadel/modules/smtp/serv_smtpeventclient.c +++ b/citadel/modules/smtp/serv_smtpeventclient.c @@ -264,10 +264,10 @@ eNextState mx_connect_ip(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)