]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2862] Pass the update command to the list manager
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 12 Jul 2013 09:35:07 +0000 (11:35 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 12 Jul 2013 09:43:01 +0000 (11:43 +0200)
Pass the sgmtinfo-update command to the client list manager and ack the
segment when done.

Not tested, as there's interaction with the command channel and threads
and external modules. Too much plumbing and too little functionality to
test.

src/bin/auth/auth_srv.cc
src/bin/auth/auth_srv.h

index 36b495ae535f56a5eb9a4e36f55575a9ee2612bb..9f14ac1c2729f3e2c5a10644bd8b956d788c84d7 100644 (file)
@@ -972,9 +972,34 @@ AuthSrv::listsReconfigured() {
     const bool has_remote = hasRemoteSegment(impl_->datasrc_clients_mgr_);
     if (has_remote && !impl_->readers_subscribed_) {
         impl_->config_session_->subscribe("SegmentReader");
+        impl_->config_session_->
+            setUnhandledCallback(boost::bind(&AuthSrv::foreignCommand, this,
+                                             _1, _2, _3));
         impl_->readers_subscribed_ = true;
     } else if (!has_remote && impl_->readers_subscribed_) {
         impl_->config_session_->unsubscribe("SegmentReader");
+        impl_->config_session_->
+            setUnhandledCallback(isc::config::ModuleCCSession::
+                                 UnhandledCallback());
         impl_->readers_subscribed_ = false;
     }
 }
+
+void
+AuthSrv::reconfigureDone(ConstElementPtr params) {
+    // ACK the segment
+    impl_->config_session_->
+        groupSendMsg(isc::config::createCommand("sgmtinfo-update-ack",
+                                                params), "MemMgr");
+}
+
+void
+AuthSrv::foreignCommand(const std::string& command, const std::string&,
+                        const ConstElementPtr& params)
+{
+    if (command == "sgmtinfo-update") {
+        impl_->datasrc_clients_mgr_.
+            segmentInfoUpdate(params, boost::bind(&AuthSrv::reconfigureDone,
+                                                  this, params));
+    }
+}
index a57ed0cf54325cba6fa136a206b0d0d603ab3ecf..1c49d4f783a8b9278db8485ac7183d8ff1f00459 100644 (file)
@@ -282,6 +282,9 @@ public:
     void listsReconfigured();
 
 private:
+    void reconfigureDone(isc::data::ConstElementPtr request);
+    void foreignCommand(const std::string& command, const std::string&,
+                        const isc::data::ConstElementPtr& params);
     AuthSrvImpl* impl_;
     isc::asiolink::SimpleCallback* checkin_;
     isc::asiodns::DNSLookup* dns_lookup_;