Commit b5fa0bf0 authored by Jerry's avatar Jerry
Browse files

remove useless code line


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac335@3169 e5f2f494-b856-4b98-b285-d166d9295462
parent 26595cb4
......@@ -57,6 +57,16 @@ class MyZonemgrRefresh(ZonemgrRefresh):
'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 @@ class TestZonemgrRefresh(unittest.TestCase):
# 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 @@ class TestZonemgrRefresh(unittest.TestCase):
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):
......
......@@ -335,8 +335,7 @@ class ZonemgrRefresh:
"""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 @@ class ZonemgrRefresh:
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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment