1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 15:36:38 +02:00

Move DNS handling to a module

This commit is contained in:
Adam
2012-12-15 01:33:31 -05:00
parent cdec0a3f96
commit dcd34d3728
17 changed files with 1314 additions and 1368 deletions
+3 -5
View File
@@ -15,7 +15,6 @@
#include "config.h"
#include "protocol.h"
#include "servers.h"
#include "dns.h"
UplinkSocket *UplinkSock = NULL;
@@ -48,10 +47,9 @@ void Uplink::Connect()
if (!Config->LocalHost.empty())
UplinkSock->Bind(Config->LocalHost);
FOREACH_MOD(I_OnPreServerConnect, OnPreServerConnect());
DNS::Query rep = DNS::Manager::BlockingQuery(u->host, u->ipv6 ? DNS::QUERY_AAAA : DNS::QUERY_A);
Anope::string reply_ip = !rep.answers.empty() ? rep.answers.front().rdata : u->host;
Log(LOG_TERMINAL) << "Attempting to connect to uplink #" << (Anope::CurrentUplink + 1) << " " << u->host << " (" << reply_ip << "), port " << u->port;
UplinkSock->Connect(reply_ip, u->port);
Anope::string ip = Anope::Resolve(u->host, u->ipv6 ? AF_INET6 : AF_INET);
Log(LOG_TERMINAL) << "Attempting to connect to uplink #" << (Anope::CurrentUplink + 1) << " " << u->host << " (" << ip << "), port " << u->port;
UplinkSock->Connect(ip, u->port);
}