diff options
author | Adam <Adam@anope.org> | 2012-11-01 13:32:38 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-01 14:47:23 -0400 |
commit | 90930619bc124e94bac5048c0b13c3f4748b559d (patch) | |
tree | cbe2325f6295aa188a6dd0f0d56d336eab060bbe /src/dns.cpp | |
parent | 5b1c8230191fa626ef9210c5035f14a8df4c0ed6 (diff) |
Fixed quite a bit of dumbness with m_ssl. Had to
modify socketengines to allow polling for write &
no read, but is it cleaner now. Made m_httpd able
to listen using SSL.
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index f88e9adfd..29c3134f7 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -519,7 +519,7 @@ void DNSManager::TCPSocket::Client::Reply(DNSPacket *p) { delete packet; packet = p; - SocketEngine::MarkWritable(this); + SocketEngine::Change(this, true, SF_WRITABLE); } bool DNSManager::TCPSocket::Client::ProcessRead() @@ -535,9 +535,8 @@ bool DNSManager::TCPSocket::Client::ProcessRead() short want_len = packet_buffer[0] << 8 | packet_buffer[1]; if (length >= want_len - 2) { - int len = length - 2; - length = 0; - return DNSEngine->HandlePacket(this, packet_buffer + 2, len, NULL); + SocketEngine::Change(this, false, SF_READABLE); + return DNSEngine->HandlePacket(this, packet_buffer + 2, length - 2, NULL); } return true; } @@ -565,7 +564,7 @@ bool DNSManager::TCPSocket::Client::ProcessWrite() packet = NULL; } - SocketEngine::ClearWritable(this); + SocketEngine::Change(this, false, SF_WRITABLE); return true; /* Do not return false here, bind is unhappy we close the connection so soon after sending */ } @@ -591,7 +590,7 @@ DNSManager::UDPSocket::~UDPSocket() void DNSManager::UDPSocket::Reply(DNSPacket *p) { packets.push_back(p); - SocketEngine::MarkWritable(this); + SocketEngine::Change(this, true, SF_WRITABLE); } bool DNSManager::UDPSocket::ProcessRead() @@ -626,7 +625,7 @@ bool DNSManager::UDPSocket::ProcessWrite() } if (packets.empty()) - SocketEngine::ClearWritable(this); + SocketEngine::Change(this, false, SF_WRITABLE); return true; } @@ -848,7 +847,7 @@ bool DNSManager::CheckCache(DNSRequest *request) for (cache_map::iterator it_end = this->cache.upper_bound(request->name); it != it_end; ++it) { ResourceRecord &rec = it->second; - if (rec.created + rec.ttl >= Anope::CurTime) + if (rec.created + static_cast<time_t>(rec.ttl) >= Anope::CurTime) record.answers.push_back(rec); } @@ -873,7 +872,7 @@ void DNSManager::Tick(time_t now) it_next = it; ++it_next; - if (req.created + req.ttl < now) + if (req.created + static_cast<time_t>(req.ttl) < now) this->cache.erase(it); } } |