BIND 10 trac922, updated. bc0688b0e7846ec9bb38e4e014ed23be84876948 [trac922] Some documentation
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon May 16 17:25:39 UTC 2011
The branch, trac922 has been updated
via bc0688b0e7846ec9bb38e4e014ed23be84876948 (commit)
via b8a7bf58c974c9ba4518fd894963cd66a19baf7e (commit)
via 3a54f64afc94e9394a527872b957609d14002ff1 (commit)
from 94d43a69237b5d2bf671e384ff8b2b9a5ce445b4 (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 bc0688b0e7846ec9bb38e4e014ed23be84876948
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon May 16 19:20:17 2011 +0200
[trac922] Some documentation
commit b8a7bf58c974c9ba4518fd894963cd66a19baf7e
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon May 16 19:18:00 2011 +0200
[trac922] Using a parameter to distinguish filename
commit 3a54f64afc94e9394a527872b957609d14002ff1
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon May 16 19:10:48 2011 +0200
[trac922] Subscribe moved just before return
This minimises chances of subscribing and then throwing.
-----------------------------------------------------------------------
Summary of changes:
src/lib/config/ccsession.cc | 7 ++++---
src/lib/config/ccsession.h | 15 ++++++++++-----
src/lib/config/tests/ccsession_unittests.cc | 3 ++-
3 files changed, 16 insertions(+), 9 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/config/ccsession.cc b/src/lib/config/ccsession.cc
index 81eadab..45710e3 100644
--- a/src/lib/config/ccsession.cc
+++ b/src/lib/config/ccsession.cc
@@ -358,11 +358,12 @@ ModuleCCSession::checkCommand() {
std::string
ModuleCCSession::addRemoteConfig(const std::string& spec_name,
void (*handler)(const std::string& module,
- ConstElementPtr))
+ ConstElementPtr),
+ bool spec_is_filename)
{
std::string module_name;
ModuleSpec rmod_spec;
- if (spec_name.find_first_of("./") != std::string::npos) {
+ if (spec_is_filename) {
// It's a file name, so load it
rmod_spec = readModuleSpecification(spec_name);
module_name =
@@ -389,7 +390,6 @@ ModuleCCSession::addRemoteConfig(const std::string& spec_name,
}
}
ConfigData rmod_config = ConfigData(rmod_spec);
- session_.subscribe(module_name);
// Get the current configuration values for that module
ConstElementPtr cmd = Element::fromJSON("{ \"command\": [\"get_config\", {\"module_name\":\"" + module_name + "\"} ] }");
@@ -414,6 +414,7 @@ ModuleCCSession::addRemoteConfig(const std::string& spec_name,
remote_module_handlers_[module_name] = handler;
handler(module_name, local_config);
}
+ session_.subscribe(module_name);
return (module_name);
}
diff --git a/src/lib/config/ccsession.h b/src/lib/config/ccsession.h
index 5c21ba0..c845b8f 100644
--- a/src/lib/config/ccsession.h
+++ b/src/lib/config/ccsession.h
@@ -244,22 +244,27 @@ public:
* filename of the spec file to use or a name of module
* (in case it's a module name, the spec data is
* downloaded from the configuration manager, therefore
- * the configuration manager must know it). A heuristic
- * is used to guess which should be used - if it contains
- * a slash or dot, filename is assumed, otherwise
- * name of module is assumed.
+ * the configuration manager must know it). If
+ * spec_is_filenabe is true (the default), then a
+ * filename is assumed, otherwise a module name.
* \param handler The handler function called whenever there's a change.
* Called once initally from this function. May be NULL
* if you don't want any handler to be called and you're
* fine with requesting the data through
* getRemoteConfigValue() each time.
+ *
+ * The handler should not throw, or it'll fall trough and
+ * the exception will get into strange places, probably
+ * aborting the application.
+ * \param spec_is_filename Says if spec_name is filename or module name.
* \return The name of the module specified in the given specification
* file
*/
std::string addRemoteConfig(const std::string& spec_name,
void (*handler)(const std::string& module_name,
isc::data::ConstElementPtr
- update) = NULL);
+ update) = NULL,
+ bool spec_is_filename = true);
/**
* Removes the module with the given name from the remote config
diff --git a/src/lib/config/tests/ccsession_unittests.cc b/src/lib/config/tests/ccsession_unittests.cc
index bce3e51..3564d4b 100644
--- a/src/lib/config/tests/ccsession_unittests.cc
+++ b/src/lib/config/tests/ccsession_unittests.cc
@@ -412,7 +412,8 @@ TEST_F(CCSessionTest, remoteConfig) {
session.getMessages()->add(createAnswer(0, spec.getFullSpec()));
session.getMessages()->add(createAnswer(0, el("{}")));
- EXPECT_NO_THROW(module_name = mccs.addRemoteConfig("Spec2"));
+ EXPECT_NO_THROW(module_name = mccs.addRemoteConfig("Spec2", NULL,
+ false));
EXPECT_EQ("Spec2", module_name);
EXPECT_NO_THROW(item1 =
More information about the bind10-changes
mailing list