BIND 10 trac1789, updated. 56338ac70f174880ff1ca73bda0afe73dad2e7d4 [1789] more review comments
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Apr 12 10:52:52 UTC 2012
The branch, trac1789 has been updated
via 56338ac70f174880ff1ca73bda0afe73dad2e7d4 (commit)
from 7ce82914391a42fde56946b284f386bf0f3fe169 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 56338ac70f174880ff1ca73bda0afe73dad2e7d4
Author: Jelte Jansen <jelte at isc.org>
Date: Thu Apr 12 12:51:35 2012 +0200
[1789] more review comments
in xfrin
- add note about lack of thread-safety
- add note about from-source temporariness
- add test for case-insensitive class strings
- directly replace _memory_zones
-----------------------------------------------------------------------
Summary of changes:
src/bin/xfrin/tests/xfrin_test.py | 6 ++----
src/bin/xfrin/xfrin.py.in | 24 ++++++++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/xfrin/tests/xfrin_test.py b/src/bin/xfrin/tests/xfrin_test.py
index 04df8bf..b88d6a9 100644
--- a/src/bin/xfrin/tests/xfrin_test.py
+++ b/src/bin/xfrin/tests/xfrin_test.py
@@ -2597,7 +2597,7 @@ class TextXfrinMemoryZones(unittest.TestCase):
]
},
{ 'type': 'memory',
- 'class': 'CH',
+ 'class': 'ch',
'zones': [
{ 'origin': 'example.com',
'filetype': 'sqlite3' }
@@ -2655,6 +2655,7 @@ class TextXfrinMemoryZones(unittest.TestCase):
# make sure it is case insensitive, root-dot-insensitive,
# and supports CLASSXXX notation
self.assertTrue(self.xfr._is_memory_zone("EXAMPLE.com", "IN"))
+ self.assertTrue(self.xfr._is_memory_zone("example.com", "in"))
self.assertTrue(self.xfr._is_memory_zone("example2.com.", "IN"))
self.assertTrue(self.xfr._is_memory_zone("example.com", "CLASS3"))
@@ -2704,9 +2705,6 @@ class TextXfrinMemoryZones(unittest.TestCase):
self.assertFalse(self.xfr._is_memory_zone("example3.com", "IN"))
self.assertTrue(self.xfr._is_memory_zone("example.com", "CH"))
-
-
-
def raise_interrupt():
raise KeyboardInterrupt()
diff --git a/src/bin/xfrin/xfrin.py.in b/src/bin/xfrin/xfrin.py.in
index a8df637..a60ad7f 100755
--- a/src/bin/xfrin/xfrin.py.in
+++ b/src/bin/xfrin/xfrin.py.in
@@ -1332,6 +1332,10 @@ class Xfrin:
"""Returns true if the given zone/class combination is configured
in the in-memory datasource of the Auth process with file type
'sqlite3'.
+ Note: this method is not thread-safe. We are considering
+ changing the threaded model here, but if we do not, take
+ care in accessing and updating the memory zone set (or add
+ locks)
"""
# Normalize them first, if either conversion fails, return false
# (they won't be in the set anyway)
@@ -1342,15 +1346,15 @@ class Xfrin:
return False
return (zone_name_str, zone_class_str) in self._memory_zones
- def _add_memory_zone(self, zone_name_str, zone_class_str):
- """Add the given zone and class to the internal list of zones
- in memory datasources with file type 'sqlite3'"""
- self._memory_zones.add((zone_name_str, zone_class_str))
-
def _set_memory_zones(self, new_config, config_data):
"""Part of the _auth_config_handler function, keeps an internal set
of zones in the datasources config subset that have 'sqlite3' as
- their file type"""
+ their file type.
+ Note: this method is not thread-safe. We are considering
+ changing the threaded model here, but if we do not, take
+ care in accessing and updating the memory zone set (or add
+ locks)
+ """
# walk through the data and collect the memory zones
# If this causes any exception, assume we were passed bad data
# and keep the original set
@@ -1373,10 +1377,8 @@ class Xfrin:
new_memory_zones.add((zone_name_str,
ds_class.to_text()))
# Ok, we can use the data, update our list
- self._clear_memory_zones()
- for zone_str, class_str in new_memory_zones:
- self._add_memory_zone(zone_str, class_str)
- except Exception as eee:
+ self._memory_zones = new_memory_zones
+ except Exception:
# Something is wrong with the data. If this data even reached us,
# we cannot do more than assume the real module has logged and
# reported an error. Keep the old set.
@@ -1527,6 +1529,8 @@ class Xfrin:
if is_default and "B10_FROM_BUILD" in os.environ:
# override the local database setting if it is default and we
# are running from the source tree
+ # This should be hidden inside the data source library and/or
+ # done as a configuration, and this special case should be gone).
db_file = os.environ["B10_FROM_BUILD"] + os.sep +\
"bind10_zones.sqlite3"
self._db_file = db_file
More information about the bind10-changes
mailing list