From 3c8a71126d0a3bcd737ace67042f5c032ef2a4a2 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Sun, 22 Dec 2013 19:48:30 +0100 Subject: [PATCH] make notification queue ipv6 compatible --- pdns/communicator.hh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pdns/communicator.hh b/pdns/communicator.hh index d7c14e130d..1203ef267c 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -68,26 +68,26 @@ class NotificationQueue public: void add(const string &domain, const string &ip) { + const ComboAddress caIp(ip); + NotificationRequest nr; nr.domain = domain; - nr.ip = ip; + nr.ip = caIp.toStringWithPort(); nr.attempts = 0; nr.id = Utility::random()%0xffff; nr.next = time(0); d_nqueue.push_back(nr); } - + bool removeIf(const string &remote, uint16_t id, const string &domain) { + ServiceTuple stRemote, stQueued; + parseService(remote, stRemote); + for(d_nqueue_t::iterator i=d_nqueue.begin(); i!=d_nqueue.end(); ++i) { - // cout<id<<" "<ip<<" "<domain<<" "<ip, ':'); - if(i->id==id && ourIP == remoteIP && i->domain==domain) { + parseService(i->ip, stQueued); + if(i->id==id && stQueued.host == stRemote.host && i->domain==domain) { d_nqueue.erase(i); return true; } @@ -114,7 +114,7 @@ public: } return false; } - + time_t earliest() { time_t early=std::numeric_limits::max() - 1; @@ -122,7 +122,9 @@ public: early=min(early,i->next); return early-time(0); } + void dump(); + private: struct NotificationRequest { -- 2.47.2