Commit 0c998ea2 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

sample code responding to statistics requests


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@270 e5f2f494-b856-4b98-b285-d166d9295462
parent 8f9a4c38
...@@ -58,3 +58,21 @@ CommandSession::getCommand() { ...@@ -58,3 +58,21 @@ CommandSession::getCommand() {
return std::pair<string, string>("unknown", ""); return std::pair<string, string>("unknown", "");
} }
void
handleStatRequest()
{
ISC::Data::ElementPtr ep, routing, data;
session.group_recvmsg(routing, data, false);
ep = data->get("command");
if (ep != NULL && ep->string_value() == "getstat") {
struct timeval now;
ElementPtr resp = Element::create(std::map<std::string, ElementPtr>());
gettimeofday(&now, NULL);
resp->set("sent", Element::create(now.tv_sec +
(double)now.tv_usec / 1000000));
resp->set("counter", Element::create(++counter));
session.group_sendmsg(resp, "statistics");
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment