]> granicus.if.org Git - pdns/commitdiff
64-bit fix for the slave cycle interval, which might lead to locked up systems!
authorBert Hubert <bert.hubert@netherlabs.nl>
Sat, 17 Nov 2007 21:30:56 +0000 (21:30 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sat, 17 Nov 2007 21:30:56 +0000 (21:30 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1105 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/communicator.cc
pdns/communicator.hh

index 0a1e7dda8eee795d7781c153a350bda536e4a4ef..1a9f00d90f915be87cf7dbc9a09ee6a3d0a5ad48 100644 (file)
@@ -55,6 +55,7 @@ void CommunicatorClass::addSuckRequest(const string &domain, const string &maste
 
 void CommunicatorClass::suck(const string &domain,const string &remote)
 {
+  L<<Logger::Error<<"Initiating transfer of '"<<domain<<"' from remote '"<<remote<<"'"<<endl;
   uint32_t domain_id;
   PacketHandler P;
 
@@ -288,7 +289,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
   }
 }  
 
-int CommunicatorClass::doNotifications()
+time_t CommunicatorClass::doNotifications()
 {
   ComboAddress from;
   Utility::socklen_t fromlen=sizeof(from);
@@ -423,7 +424,7 @@ void CommunicatorClass::mainloop(void)
     int rc;
     time_t next;
 
-    int tick;
+    time_t tick;
 
     for(;;) {
       slaveRefresh(&P);
@@ -432,9 +433,10 @@ void CommunicatorClass::mainloop(void)
       tick=min(doNotifications(),
               d_tickinterval);
 
+      L<<Logger::Error<<"tick = "<<tick<<", d_tickinterval = "<<d_tickinterval<<endl;
       next=time(0)+tick;
 
-      while(time(0)<next) {
+      while(time(0) < next) {
        rc=d_any_sem.tryWait();
 
        if(rc)
index 9c5de66dd1dbbc4d78677fe6286e7c8b93607025..934193e7e6af850212ea8de52f8f53942a7d774e 100644 (file)
@@ -131,7 +131,7 @@ public:
     d_tickinterval=60;
     d_masterschanged=d_slaveschanged=true;
   }
-  int doNotifications();    
+  time_t doNotifications();    
   void go()
   {
     pthread_t tid;
@@ -163,7 +163,7 @@ private:
   bool d_havepriosuckrequest;
   Semaphore d_suck_sem;
   Semaphore d_any_sem;
-  int d_tickinterval;
+  time_t d_tickinterval;
   NotificationQueue d_nq;
   bool d_masterschanged, d_slaveschanged;
 };