Changeset 2058
- Timestamp:
- 03/03/11 13:12:24 (2 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 5 modified
-
communicator.cc (modified) (2 diffs)
-
communicator.hh (modified) (2 diffs)
-
dnsbackend.hh (modified) (1 diff)
-
packethandler.cc (modified) (3 diffs)
-
slavecommunicator.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/communicator.cc
r2012 r2058 79 79 80 80 int rc; 81 time_t next; 82 83 time_t tick; 81 time_t next, tick; 84 82 85 83 for(;;) { 86 84 slaveRefresh(&P); 87 85 masterUpdateCheck(&P); 88 tick=doNotifications(); 86 tick=doNotifications(); // this processes any notification acknowledgements and actually send out our own notifications 89 87 90 88 tick = min (tick, d_tickinterval); 91 92 // L<<Logger::Error<<"tick = "<<tick<<", d_tickinterval = "<<d_tickinterval<<endl; 89 93 90 next=time(0)+tick; 94 91 … … 99 96 Utility::sleep(1); 100 97 else { 101 98 break; // something happened 102 99 } 103 100 // this gets executed at least once every second -
trunk/pdns/pdns/communicator.hh
r2012 r2058 156 156 bool justNotified(const string &domain, const string &ip); 157 157 void addSuckRequest(const string &domain, const string &master, bool priority=false); 158 void addSlaveCheckRequest(const DomainInfo& di, const ComboAddress& remote); 158 159 void notify(const string &domain, const string &ip); 159 160 void mainloop(); … … 190 191 NotificationQueue d_nq; 191 192 bool d_masterschanged, d_slaveschanged; 193 set<DomainInfo> d_tocheck; 192 194 }; 193 195 -
trunk/pdns/pdns/dnsbackend.hh
r2024 r2058 52 52 enum {Master,Slave,Native} kind; 53 53 DNSBackend *backend; 54 55 bool operator<(const DomainInfo& rhs) const 56 { 57 return zone < rhs.zone; 58 } 54 59 }; 55 60 -
trunk/pdns/pdns/packethandler.cc
r2050 r2058 856 856 } 857 857 858 string authServer(p->getRemote());859 858 if(::arg().contains("trusted-notification-proxy", p->getRemote())) { 860 859 L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from trusted-notification-proxy "<< p->getRemote()<<endl; … … 863 862 return RCode::Refused; 864 863 } 865 authServer = *di.masters.begin();866 864 } 867 865 else if(!db->isMaster(p->qdomain, p->getRemote())) { … … 869 867 return RCode::Refused; 870 868 } 871 authServer = *di.masters.begin(); // XXX this is actually wrong, we should be picking the master that looks most like the notification! 872 uint32_t theirserial=0; 873 874 Resolver resolver; 875 try { 876 resolver.getSoaSerial(authServer, p->qdomain, &theirserial); // XXX this should have a _really_ short timeout! 877 } 878 catch(ResolverException& re) { 879 L<<Logger::Error<<re.reason<<endl; 880 return RCode::ServFail; 881 } 882 883 if(theirserial<=di.serial) { 884 L<<Logger::Error<<"Received NOTIFY for "<<p->qdomain<<" from "<< authServer <<", we are up to date: "<< 885 theirserial<<"<="<<di.serial<<endl; 886 return RCode::NoError; 887 } 888 else { 889 L<<Logger::Error<<"Received valid NOTIFY for "<<p->qdomain<<" (id="<<di.id<<") from master "<<p->getRemote()<<": "<< 890 theirserial<<" > "<<di.serial<<endl; 891 892 Communicator.addSuckRequest(p->qdomain, authServer, true); // priority 893 return 0; 894 } 895 return -1; 869 870 871 // ok, we've done our checks 872 Communicator.addSlaveCheckRequest(di, p->remote); 873 874 return 0; 896 875 } 897 876 -
trunk/pdns/pdns/slavecommunicator.cc
r2052 r2058 57 57 58 58 if(res.second) { 59 d_suck_sem.post();59 d_suck_sem.post(); 60 60 } 61 61 } … … 244 244 }; 245 245 246 void CommunicatorClass::addSlaveCheckRequest(const DomainInfo& di, const ComboAddress& remote) 247 { 248 Lock l(&d_lock); 249 d_tocheck.insert(di); 250 d_any_sem.post(); // kick the loop! 251 } 252 246 253 void CommunicatorClass::slaveRefresh(PacketHandler *P) 247 254 { 248 255 UeberBackend *B=dynamic_cast<UeberBackend *>(P->getBackend()); 249 256 vector<DomainInfo> rdomains; 250 vector<pair<DomainInfo, bool> > sdomains; 251 B->getUnfreshSlaveInfos(&rdomains); 257 vector<pair<DomainInfo, bool> > sdomains; // the bool is for 'presigned' 258 259 { 260 Lock l(&d_lock); 261 rdomains.insert(rdomains.end(), d_tocheck.begin(), d_tocheck.end()); 262 d_tocheck.clear(); 263 } 264 265 if(rdomains.empty()) // if we have priority domains, check them first 266 B->getUnfreshSlaveInfos(&rdomains); 267 252 268 DNSSECKeeper dk; 253 269 {