mirror of
https://github.com/anope/anope.git
synced 2026-07-04 23:33:12 +02:00
Cleanup some excess whitespaces and tabs, and fix a few typos along the way.
This commit is contained in:
+21
-22
@@ -109,7 +109,7 @@ class Packet : public Query
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
Question UnpackQuestion(const unsigned char *input, unsigned short input_size, unsigned short &pos)
|
||||
{
|
||||
Question question;
|
||||
@@ -212,7 +212,7 @@ class Packet : public Query
|
||||
unsigned short id;
|
||||
/* Flags on the packet */
|
||||
unsigned short flags;
|
||||
|
||||
|
||||
Packet(Manager *m, sockaddrs *a) : manager(m), id(0), flags(0)
|
||||
{
|
||||
if (a)
|
||||
@@ -248,7 +248,7 @@ class Packet : public Query
|
||||
|
||||
for (unsigned i = 0; i < qdcount; ++i)
|
||||
this->questions.push_back(this->UnpackQuestion(input, len, packet_pos));
|
||||
|
||||
|
||||
for (unsigned i = 0; i < ancount; ++i)
|
||||
this->answers.push_back(this->UnpackResourceRecord(input, len, packet_pos));
|
||||
|
||||
@@ -270,7 +270,7 @@ class Packet : public Query
|
||||
{
|
||||
if (output_size < HEADER_LENGTH)
|
||||
throw SocketException("Unable to pack packet");
|
||||
|
||||
|
||||
unsigned short pos = 0;
|
||||
|
||||
output[pos++] = this->id >> 8;
|
||||
@@ -433,7 +433,7 @@ class Packet : public Query
|
||||
l = htonl(manager->GetSerial());
|
||||
memcpy(&output[pos], &l, 4);
|
||||
pos += 4;
|
||||
|
||||
|
||||
l = htonl(refresh); // Refresh
|
||||
memcpy(&output[pos], &l, 4);
|
||||
pos += 4;
|
||||
@@ -459,7 +459,7 @@ class Packet : public Query
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return pos;
|
||||
}
|
||||
};
|
||||
@@ -478,7 +478,7 @@ namespace DNS
|
||||
class TCPSocket : public ListenSocket
|
||||
{
|
||||
Manager *manager;
|
||||
|
||||
|
||||
public:
|
||||
/* A TCP client */
|
||||
class Client : public ClientSocket, public Timer, public ReplySocket
|
||||
@@ -487,7 +487,7 @@ class TCPSocket : public ListenSocket
|
||||
Packet *packet;
|
||||
unsigned char packet_buffer[524];
|
||||
int length;
|
||||
|
||||
|
||||
public:
|
||||
Client(Manager *m, TCPSocket *l, int fd, const sockaddrs &addr) : Socket(fd, l->IsIPv6()), ClientSocket(l, addr), Timer(5),
|
||||
manager(m), packet(NULL), length(0)
|
||||
@@ -500,7 +500,7 @@ class TCPSocket : public ListenSocket
|
||||
Log(LOG_DEBUG_2) << "Resolver: Exiting client from " << clientaddr.addr();
|
||||
delete packet;
|
||||
}
|
||||
|
||||
|
||||
/* Times out after a few seconds */
|
||||
void Tick(time_t) anope_override { }
|
||||
|
||||
@@ -560,13 +560,13 @@ class TCPSocket : public ListenSocket
|
||||
};
|
||||
|
||||
TCPSocket(Manager *m, const Anope::string &ip, int port) : Socket(-1, ip.find(':') != Anope::string::npos), ListenSocket(ip, port, ip.find(':') != Anope::string::npos), manager(m) { }
|
||||
|
||||
|
||||
ClientSocket *OnAccept(int fd, const sockaddrs &addr) anope_override
|
||||
{
|
||||
return new Client(this->manager, this, fd, addr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* Listens for UDP requests */
|
||||
class UDPSocket : public ReplySocket
|
||||
{
|
||||
@@ -581,15 +581,15 @@ class UDPSocket : public ReplySocket
|
||||
for (unsigned i = 0; i < packets.size(); ++i)
|
||||
delete packets[i];
|
||||
}
|
||||
|
||||
|
||||
void Reply(Packet *p) anope_override
|
||||
{
|
||||
packets.push_back(p);
|
||||
SocketEngine::Change(this, true, SF_WRITABLE);
|
||||
}
|
||||
|
||||
|
||||
std::deque<Packet *>& GetPackets() { return packets; }
|
||||
|
||||
|
||||
bool ProcessRead() anope_override
|
||||
{
|
||||
Log(LOG_DEBUG_2) << "Resolver: Reading from DNS UDP socket";
|
||||
@@ -600,7 +600,7 @@ class UDPSocket : public ReplySocket
|
||||
int length = recvfrom(this->GetFD(), reinterpret_cast<char *>(&packet_buffer), sizeof(packet_buffer), 0, &from_server.sa, &x);
|
||||
return this->manager->HandlePacket(this, packet_buffer, length, &from_server);
|
||||
}
|
||||
|
||||
|
||||
bool ProcessWrite() anope_override
|
||||
{
|
||||
Log(LOG_DEBUG_2) << "Resolver: Writing to DNS UDP socket";
|
||||
@@ -623,7 +623,7 @@ class UDPSocket : public ReplySocket
|
||||
|
||||
if (packets.empty())
|
||||
SocketEngine::Change(this, false, SF_WRITABLE);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -689,7 +689,7 @@ class MyManager : public Manager, public Timer
|
||||
delete tcpsock;
|
||||
|
||||
for (std::map<unsigned short, Request *>::iterator it = this->requests.begin(), it_end = this->requests.end(); it != it_end;)
|
||||
{
|
||||
{
|
||||
Request *request = it->second;
|
||||
++it;
|
||||
|
||||
@@ -767,7 +767,7 @@ class MyManager : public Manager, public Timer
|
||||
this->requests[req->id] = req;
|
||||
|
||||
req->SetSecs(timeout);
|
||||
|
||||
|
||||
Packet *p = new Packet(this, &this->addrs);
|
||||
p->flags = QUERYFLAGS_RD;
|
||||
p->id = req->id;
|
||||
@@ -931,7 +931,7 @@ class MyManager : public Manager, public Timer
|
||||
request->OnLookupComplete(&recv_packet);
|
||||
this->AddCache(recv_packet);
|
||||
}
|
||||
|
||||
|
||||
delete request;
|
||||
return true;
|
||||
}
|
||||
@@ -992,7 +992,7 @@ class MyManager : public Manager, public Timer
|
||||
this->cache.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
/** Add a record to the dns cache
|
||||
* @param r The record
|
||||
@@ -1020,7 +1020,7 @@ class MyManager : public Manager, public Timer
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
class ModuleDNS : public Module
|
||||
@@ -1139,4 +1139,3 @@ class ModuleDNS : public Module
|
||||
};
|
||||
|
||||
MODULE_INIT(ModuleDNS)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user