BIND 10 trac2768, updated. 83966d1e3ede61d6e71a26d179e2d2d30b4655df [2768] Make sure the rpcCall asks for answer
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Feb 22 11:10:43 UTC 2013
The branch, trac2768 has been updated
via 83966d1e3ede61d6e71a26d179e2d2d30b4655df (commit)
via 1e0c42db90fa4f02586da442501cf1669a93db04 (commit)
via e589380dcc531fb2c3d8bf87e0e2fed8ba09270f (commit)
from 845ffd35d10646345dc1f534ad725cada568fa5c (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 83966d1e3ede61d6e71a26d179e2d2d30b4655df
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 22 11:16:30 2013 +0100
[2768] Make sure the rpcCall asks for answer
Add tests for the fact and fix it. Also, add log from the rpcCall
itself, so it can be seen in logs.
commit 1e0c42db90fa4f02586da442501cf1669a93db04
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 22 11:10:00 2013 +0100
[2768] Output seq of message waited for
To help debugging.
commit e589380dcc531fb2c3d8bf87e0e2fed8ba09270f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 22 11:07:34 2013 +0100
[2768] Add missing protocol constant
-----------------------------------------------------------------------
Summary of changes:
src/lib/cc/cc_messages.mes | 2 +-
src/lib/cc/proto_defs.cc | 1 +
src/lib/cc/session.cc | 2 +-
src/lib/config/ccsession.cc | 8 +++++---
src/lib/config/ccsession.h | 6 ++++--
src/lib/config/config_messages.mes | 4 ++++
src/lib/config/tests/ccsession_unittests.cc | 2 +-
src/lib/config/tests/fake_session.cc | 9 ++++++---
src/lib/config/tests/fake_session.h | 3 ++-
9 files changed, 25 insertions(+), 12 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/cc/cc_messages.mes b/src/lib/cc/cc_messages.mes
index b561784..9be9c7c 100644
--- a/src/lib/cc/cc_messages.mes
+++ b/src/lib/cc/cc_messages.mes
@@ -37,7 +37,7 @@ socket listed in the output.
This debug message indicates that the connection was successfully made, this
should follow CC_ESTABLISH.
-% CC_GROUP_RECEIVE trying to receive a message
+% CC_GROUP_RECEIVE trying to receive a message with seq %1
Debug message, noting that a message is expected to come over the command
channel.
diff --git a/src/lib/cc/proto_defs.cc b/src/lib/cc/proto_defs.cc
index 24d9650..72ca41b 100644
--- a/src/lib/cc/proto_defs.cc
+++ b/src/lib/cc/proto_defs.cc
@@ -39,6 +39,7 @@ const char* const CC_TO_WILDCARD = "*";
const char* const CC_INSTANCE_WILDCARD = "*";
// Reply codes
const int CC_REPLY_NO_RECPT = -1;
+const int CC_REPLY_SUCCESS = 0;
}
}
diff --git a/src/lib/cc/session.cc b/src/lib/cc/session.cc
index da78bd4..f809105 100644
--- a/src/lib/cc/session.cc
+++ b/src/lib/cc/session.cc
@@ -498,7 +498,7 @@ bool
Session::group_recvmsg(ConstElementPtr& envelope, ConstElementPtr& msg,
bool nonblock, int seq)
{
- LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_GROUP_RECEIVE);
+ LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_GROUP_RECEIVE).arg(seq);
bool result(recvmsg(envelope, msg, nonblock, seq));
if (result) {
LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_GROUP_RECEIVED).
diff --git a/src/lib/config/ccsession.cc b/src/lib/config/ccsession.cc
index cd01603..bf25050 100644
--- a/src/lib/config/ccsession.cc
+++ b/src/lib/config/ccsession.cc
@@ -32,7 +32,7 @@
#include <boost/foreach.hpp>
#include <cc/data.h>
-#include <module_spec.h>
+#include <config/module_spec.h>
#include <cc/session.h>
#include <exceptions/exceptions.h>
@@ -863,9 +863,11 @@ ModuleCCSession::rpcCall(const std::string &command, const std::string &group,
const ConstElementPtr ¶ms)
{
const ConstElementPtr &command_el(createCommand(command, params));
- const int seq = session_.group_sendmsg(command_el, group, instance, to);
+ const int seq = groupSendMsg(command_el, group, instance, to, true);
ConstElementPtr env, answer;
- session_.group_recvmsg(env, answer, false, seq);
+ LOG_DEBUG(config_logger, DBGLVL_TRACE_DETAIL, CONFIG_RPC_SEQ).arg(command).
+ arg(group).arg(seq);
+ groupRecvMsg(env, answer, true, seq);
int rcode;
const ConstElementPtr &result(parseAnswer(rcode, answer));
if (rcode == isc::cc::CC_REPLY_NO_RECPT) {
diff --git a/src/lib/config/ccsession.h b/src/lib/config/ccsession.h
index c9a6ffe..c429d7a 100644
--- a/src/lib/config/ccsession.h
+++ b/src/lib/config/ccsession.h
@@ -363,13 +363,15 @@ public:
* \param group see isc::cc::Session::group_sendmsg()
* \param instance see isc::cc::Session::group_sendmsg()
* \param to see isc::cc::Session::group_sendmsg()
+ * \param want_answer see isc::cc::Session::group_sendmsg()
* \return see isc::cc::Session::group_sendmsg()
*/
int groupSendMsg(isc::data::ConstElementPtr msg,
std::string group,
std::string instance = "*",
- std::string to = "*") {
- return (session_.group_sendmsg(msg, group, instance, to));
+ std::string to = "*",
+ bool want_answer = false) {
+ return (session_.group_sendmsg(msg, group, instance, to, want_answer));
};
/**
diff --git a/src/lib/config/config_messages.mes b/src/lib/config/config_messages.mes
index 552256c..6735b16 100644
--- a/src/lib/config/config_messages.mes
+++ b/src/lib/config/config_messages.mes
@@ -94,3 +94,7 @@ manager.
% CONFIG_OPEN_FAIL error opening %1: %2
There was an error opening the given file. The reason for the failure
is included in the message.
+
+% CONFIG_RPC_SEQ RPC call %1 to %2 with seq %3
+Debug message, saying there's a RPC call of given command to given module. It
+has internal sequence number as listed in the message.
diff --git a/src/lib/config/tests/ccsession_unittests.cc b/src/lib/config/tests/ccsession_unittests.cc
index 824125b..b7b1267 100644
--- a/src/lib/config/tests/ccsession_unittests.cc
+++ b/src/lib/config/tests/ccsession_unittests.cc
@@ -71,7 +71,7 @@ protected:
" \"command\": [\"test\", {"
" \"param1\": \"Param 1\","
" \"param2\": \"Param 2\""
- "}]}, -1]"));
+ "}]}, -1, true]"));
// The 0th one is from the initialization, to ConfigManager.
// our is the 1st.
EXPECT_TRUE(request->equals(*session.getMsgQueue()->get(1))) <<
diff --git a/src/lib/config/tests/fake_session.cc b/src/lib/config/tests/fake_session.cc
index 56a30d4..a5d81cf 100644
--- a/src/lib/config/tests/fake_session.cc
+++ b/src/lib/config/tests/fake_session.cc
@@ -183,12 +183,12 @@ FakeSession::unsubscribe(std::string group, std::string instance) {
int
FakeSession::group_sendmsg(ConstElementPtr msg, std::string group,
- std::string to, std::string, bool)
+ std::string to, std::string, bool want_answer)
{
if (throw_on_send_) {
isc_throw(Exception, "Throw on send is set in FakeSession");
}
- addMessage(msg, group, to);
+ addMessage(msg, group, to, -1, want_answer);
return (1);
}
@@ -231,13 +231,16 @@ FakeSession::getFirstMessage(std::string& group, std::string& to) const {
void
FakeSession::addMessage(ConstElementPtr msg, const std::string& group,
- const std::string& to, int seq)
+ const std::string& to, int seq, bool want_answer)
{
ElementPtr m_el = Element::createList();
m_el->add(Element::create(group));
m_el->add(Element::create(to));
m_el->add(msg);
m_el->add(Element::create(seq));
+ if (want_answer) {
+ m_el->add(Element::create(want_answer));
+ }
if (!msg_queue_) {
msg_queue_ = Element::createList();
}
diff --git a/src/lib/config/tests/fake_session.h b/src/lib/config/tests/fake_session.h
index 0dbaadb..8a564a8 100644
--- a/src/lib/config/tests/fake_session.h
+++ b/src/lib/config/tests/fake_session.h
@@ -75,7 +75,8 @@ public:
isc::data::ConstElementPtr getFirstMessage(std::string& group,
std::string& to) const;
void addMessage(isc::data::ConstElementPtr, const std::string& group,
- const std::string& to, int seq = -1);
+ const std::string& to, int seq = -1,
+ bool want_answer = false);
bool haveSubscription(const std::string& group,
const std::string& instance);
bool haveSubscription(const isc::data::ConstElementPtr group,
More information about the bind10-changes
mailing list