Skip to content

Commit 3c8a711

Browse files
committed
make notification queue ipv6 compatible
1 parent 0c13e45 commit 3c8a711

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

pdns/communicator.hh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,26 @@ class NotificationQueue
6868
public:
6969
void add(const string &domain, const string &ip)
7070
{
71+
const ComboAddress caIp(ip);
72+
7173
NotificationRequest nr;
7274
nr.domain = domain;
73-
nr.ip = ip;
75+
nr.ip = caIp.toStringWithPort();
7476
nr.attempts = 0;
7577
nr.id = Utility::random()%0xffff;
7678
nr.next = time(0);
7779

7880
d_nqueue.push_back(nr);
7981
}
80-
82+
8183
bool removeIf(const string &remote, uint16_t id, const string &domain)
8284
{
85+
ServiceTuple stRemote, stQueued;
86+
parseService(remote, stRemote);
87+
8388
for(d_nqueue_t::iterator i=d_nqueue.begin(); i!=d_nqueue.end(); ++i) {
84-
// cout<<i->id<<" "<<id<<endl;
85-
//cout<<i->ip<<" "<<remote<<endl;
86-
//cout<<i->domain<<" "<<domain<<endl;
87-
string remoteIP, ourIP, port;
88-
tie(remoteIP, port)=splitField(remote, ':');
89-
tie(ourIP, port)=splitField(i->ip, ':');
90-
if(i->id==id && ourIP == remoteIP && i->domain==domain) {
89+
parseService(i->ip, stQueued);
90+
if(i->id==id && stQueued.host == stRemote.host && i->domain==domain) {
9191
d_nqueue.erase(i);
9292
return true;
9393
}
@@ -114,15 +114,17 @@ public:
114114
}
115115
return false;
116116
}
117-
117+
118118
time_t earliest()
119119
{
120120
time_t early=std::numeric_limits<time_t>::max() - 1;
121121
for(d_nqueue_t::const_iterator i=d_nqueue.begin();i!=d_nqueue.end();++i)
122122
early=min(early,i->next);
123123
return early-time(0);
124124
}
125+
125126
void dump();
127+
126128
private:
127129
struct NotificationRequest
128130
{

0 commit comments

Comments
 (0)