[svn] commit: r3169 - in /branches/trac335/src/bin/zonemgr: tests/zonemgr_test.py zonemgr.py.in

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Oct 11 07:09:12 UTC 2010


Author: chenzhengzhang
Date: Mon Oct 11 07:09:11 2010
New Revision: 3169

Log:
remove useless code line

Modified:
    branches/trac335/src/bin/zonemgr/tests/zonemgr_test.py
    branches/trac335/src/bin/zonemgr/zonemgr.py.in

Modified: branches/trac335/src/bin/zonemgr/tests/zonemgr_test.py
==============================================================================
--- branches/trac335/src/bin/zonemgr/tests/zonemgr_test.py (original)
+++ branches/trac335/src/bin/zonemgr/tests/zonemgr_test.py Mon Oct 11 07:09:11 2010
@@ -57,6 +57,16 @@
          'zone_soa_rdata': 'a.dns.cn. root.cnnic.cn. 2009073112 7200 3600 2419200 21600', 
          'zone_state': 0}
         } 
+
+    def stop_timer(self):
+        ''' Exit timer thread '''
+        self.shutdown()
+        main_thread = threading.currentThread()
+        for th in threading.enumerate():
+            if th is main_thread:
+                continue
+            th.join()
+
         
 class TestZonemgrRefresh(unittest.TestCase):
     def setUp(self):
@@ -397,12 +407,7 @@
         # Sleep 1 sec to ensure that the timer thread has enough time to run.
         time.sleep(1)
         # Shut down the timer thread
-        self.zone_refresh.shutdown()
-        main_thread = threading.currentThread()
-        for th in threading.enumerate():
-            if th is main_thread:
-                continue
-            th.join()
+        self.zone_refresh.stop_timer()
         # After running timer, the zone's state should become "refreshing".
         zone_state = self.zone_refresh._zonemgr_refresh_info[ZONE_NAME_CLASS1_IN]["zone_state"]
         self.assertTrue("refresh_timeout" in self.zone_refresh._zonemgr_refresh_info[ZONE_NAME_CLASS1_IN].keys())
@@ -414,12 +419,7 @@
         listener.start()
         self.assertTrue(listener.is_alive())
         # Shut down the timer thread
-        self.zone_refresh.shutdown()
-        main_thread = threading.currentThread()
-        for th in threading.enumerate():
-            if th is main_thread:
-                continue
-            th.join()
+        self.zone_refresh.stop_timer()
         self.assertFalse(listener.is_alive())
 
     def tearDown(self):

Modified: branches/trac335/src/bin/zonemgr/zonemgr.py.in
==============================================================================
--- branches/trac335/src/bin/zonemgr/zonemgr.py.in (original)
+++ branches/trac335/src/bin/zonemgr/zonemgr.py.in Mon Oct 11 07:09:11 2010
@@ -335,8 +335,7 @@
         """Keep track of zone timers. The loop can be stopped by calling shutdown() in 
         another thread.
         """
-        runnable = True
-        while runnable:
+        while True:
             # Zonemgr has no zone.
             if self._zone_mgr_is_empty():
                 time.sleep(LOWERBOUND_RETRY) # A better time?
@@ -367,8 +366,7 @@
                 continue
             if self._read_sock in rlist: # awaken by shutdown socket 
                 self._read_sock.recv(32)
-                runnable = False
-                continue 
+                return
             if self._check_sock in rlist: # awaken by check socket
                 self._check_sock.recv(32)
 




More information about the bind10-changes mailing list