]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2879] simplification: removed EVENT_NONE as it's simply unused
authorJINMEI Tatuya <jinmei@isc.org>
Mon, 22 Apr 2013 22:00:28 +0000 (15:00 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Mon, 22 Apr 2013 22:00:28 +0000 (15:00 -0700)
src/lib/python/isc/notify/notify_out.py
src/lib/python/isc/notify/tests/notify_out_test.py

index 8f669b49488a8280b3be9c1bc677171213495d69..8cdc23c619f9939241a8b72d03698c85e8791ee3 100644 (file)
@@ -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:
index 3f2c908fdf0514befabf5fd0f9c5bad9dd7b38fd..dda3f7f91504c9a1cea2d2b3909fdd95f99dfe9e 100644 (file)
@@ -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')