Browse Source

[2879] simplification: removed EVENT_NONE as it's simply unused

JINMEI Tatuya 12 years ago
parent
commit
eab6ead64d

+ 4 - 3
src/lib/python/isc/notify/notify_out.py

@@ -41,7 +41,6 @@ ZONE_XFRIN_FAILED = 'zone_xfrin_failed'
 
 _MAX_NOTIFY_NUM = 30
 _MAX_NOTIFY_TRY_NUM = 5
-_EVENT_NONE = 0
 _EVENT_READ = 1
 _EVENT_TIMEOUT = 2
 _NOTIFY_TIMEOUT = 1
@@ -441,8 +440,10 @@ class NotifyOut:
                 if self._handle_notify_reply(zone_notify_info, reply, tgt):
                     self._notify_next_target(zone_notify_info)
 
-        elif event_type == _EVENT_TIMEOUT and zone_notify_info.notify_try_num > 0:
-            logger.info(NOTIFY_OUT_TIMEOUT, AddressFormatter(tgt))
+        else:
+            assert event_type == _EVENT_TIMEOUT
+            if zone_notify_info.notify_try_num > 0:
+                logger.info(NOTIFY_OUT_TIMEOUT, AddressFormatter(tgt))
 
         tgt = zone_notify_info.get_current_notify_target()
         if tgt:

+ 3 - 3
src/lib/python/isc/notify/tests/notify_out_test.py

@@ -352,11 +352,11 @@ class TestNotifyOut(unittest.TestCase):
         # bigger than 2 seconds:
         self.assertGreater(example_net_info.notify_timeout, time1 + 2)
 
+        # Possible event is "read" or "timeout".
         cur_tgt = example_net_info._notify_current
         example_net_info.notify_try_num = notify_out._MAX_NOTIFY_TRY_NUM
-        self._notify._zone_notify_handler(example_net_info,
-                                          notify_out._EVENT_NONE)
-        self.assertNotEqual(cur_tgt, example_net_info._notify_current)
+        self.assertRaises(AssertionError, self._notify._zone_notify_handler,
+                          example_net_info, notify_out._EVENT_TIMEOUT + 1)
 
         cur_tgt = example_net_info._notify_current
         example_net_info.create_socket('127.0.0.1')