Browse Source

[1165] a small (not really related to the task though) refactoring:
simply use the spec default values in initialization of UnixSockServer.
this way we can avoid redundant initialization.

JINMEI Tatuya 13 years ago
parent
commit
ed8d686171
2 changed files with 3 additions and 8 deletions
  1. 2 2
      src/bin/xfrout/tests/xfrout_test.py.in
  2. 1 6
      src/bin/xfrout/xfrout.py.in

+ 2 - 2
src/bin/xfrout/tests/xfrout_test.py.in

@@ -656,9 +656,9 @@ class MyCCSession(isc.config.ConfigData):
 class MyUnixSockServer(UnixSockServer):
     def __init__(self):
         self._shutdown_event = threading.Event()
-        self._max_transfers_out = 10
-        self._cc = MyCCSession()
         self._common_init()
+        self._cc = MyCCSession()
+        self.update_config_data(self._cc.get_full_config())
 
 class TestUnixSockServer(unittest.TestCase):
     def setUp(self):

+ 1 - 6
src/bin/xfrout/xfrout.py.in

@@ -91,7 +91,6 @@ init_paths()
 
 SPECFILE_LOCATION = SPECFILE_PATH + "/xfrout.spec"
 AUTH_SPECFILE_LOCATION = AUTH_SPECFILE_PATH + os.sep + "auth.spec"
-MAX_TRANSFERS_OUT = 10
 VERBOSE_MODE = False
 # tsig sign every N axfr packets.
 TSIG_SIGN_EVERY_NTH = 96
@@ -429,13 +428,9 @@ class UnixSockServer(socketserver_mixin.NoPollMixIn,
         self.update_config_data(config_data)
 
     def _common_init(self):
+        '''Initialization shared with the mock server class used for tests'''
         self._lock = threading.Lock()
         self._transfers_counter = 0
-        # These default values will probably get overwritten by the (same)
-        # default value from the spec file. These are here just to make
-        # sure and to make the default values in tests consistent.
-        self._acl = REQUEST_LOADER.load('[{"action": "ACCEPT"}]')
-        self._zone_config = {}
 
     def _receive_query_message(self, sock):
         ''' receive request message from sock'''