+
+ }
+*/
+ /// TODO: else fail!
+ InitEventIO(IO, SendMsg,
+ SMTP_C_ConnTimeout,
+ SMTP_C_ReadTimeouts[0],
+ 1);
+}
+
+void get_one_mx_host_ip_done(void *Ctx,
+ int status,
+ int timeouts,
+ struct hostent *hostent)
+{
+ AsyncIO *IO = (AsyncIO *) Ctx;
+ SmtpOutMsg *SendMsg = IO->Data;
+
+ if ((status == ARES_SUCCESS) && (hostent != NULL) ) {
+
+ IO->IP6 = hostent->h_addrtype == AF_INET6;
+
+ memset(&IO->Addr, 0, sizeof(struct in6_addr));
+ if (IO->IP6) {
+ memcpy(&IO->Addr.sin6_addr.s6_addr,
+ IO->HEnt->h_addr_list[0],
+ sizeof(struct in6_addr));
+
+ IO->Addr.sin6_family = hostent->h_addrtype;
+ IO->Addr.sin6_port = htons(IO->dport);
+ }
+ else {
+ struct sockaddr_in *addr = (struct sockaddr_in*) &IO->Addr;
+ /* Bypass the ns lookup result like this: IO->Addr.sin_addr.s_addr = inet_addr("127.0.0.1"); */
+ memcpy(&addr->sin_addr,
+ IO->HEnt->h_addr_list[0],
+ sizeof(struct in_addr));
+
+ addr->sin_family = hostent->h_addrtype;
+ addr->sin_port = htons(IO->dport);
+
+ }