@@ -68,26 +68,26 @@ class NotificationQueue
68
68
public:
69
69
void add (const string &domain, const string &ip)
70
70
{
71
+ const ComboAddress caIp (ip);
72
+
71
73
NotificationRequest nr;
72
74
nr.domain = domain;
73
- nr.ip = ip ;
75
+ nr.ip = caIp. toStringWithPort () ;
74
76
nr.attempts = 0 ;
75
77
nr.id = Utility::random ()%0xffff ;
76
78
nr.next = time (0 );
77
79
78
80
d_nqueue.push_back (nr);
79
81
}
80
-
82
+
81
83
bool removeIf (const string &remote, uint16_t id, const string &domain)
82
84
{
85
+ ServiceTuple stRemote, stQueued;
86
+ parseService (remote, stRemote);
87
+
83
88
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) {
91
91
d_nqueue.erase (i);
92
92
return true ;
93
93
}
@@ -114,15 +114,17 @@ public:
114
114
}
115
115
return false ;
116
116
}
117
-
117
+
118
118
time_t earliest ()
119
119
{
120
120
time_t early=std::numeric_limits<time_t >::max () - 1 ;
121
121
for (d_nqueue_t ::const_iterator i=d_nqueue.begin ();i!=d_nqueue.end ();++i)
122
122
early=min (early,i->next );
123
123
return early-time (0 );
124
124
}
125
+
125
126
void dump ();
127
+
126
128
private:
127
129
struct NotificationRequest
128
130
{
0 commit comments