]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2202] Don't release the lock until rendered
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 1 Oct 2012 13:44:02 +0000 (15:44 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 1 Oct 2012 13:44:02 +0000 (15:44 +0200)
Since the message could contain some data from inside of the locked
lists/data sources, we need to keep the lock until we render it.

src/bin/auth/auth_srv.cc

index 9f6becff20614c7383a15bb170a2906732699c64..04dc299074a84c112e0d0884f1225e31097112f0 100644 (file)
@@ -629,13 +629,13 @@ AuthSrvImpl::processNormalQuery(const IOMessage& io_message, Message& message,
         local_edns->setUDPSize(AuthSrvImpl::DEFAULT_LOCAL_UDPSIZE);
         message.setEDNS(local_edns);
     }
+    // Lock the client lists and keep them under the lock until the processing
+    // and rendering is done (this is the same mutex as from
+    // AuthSrv::getClientListMutex()).
+    isc::util::thread::Mutex::Locker locker(mutex_);
 
     try {
         const ConstQuestionPtr question = *message.beginQuestion();
-        // Lock the client lists and keep them under the lock until
-        // the processing is done (this is the same mutex as from
-        // AuthSrv::getClientListMutex()).
-        isc::util::thread::Mutex::Locker locker(mutex_);
         const boost::shared_ptr<datasrc::ClientList>
             list(getClientList(question->getClass()));
         if (list) {
@@ -664,6 +664,8 @@ AuthSrvImpl::processNormalQuery(const IOMessage& io_message, Message& message,
     LOG_DEBUG(auth_logger, DBG_AUTH_MESSAGES, AUTH_SEND_NORMAL_RESPONSE)
               .arg(renderer_.getLength()).arg(message);
     return (true);
+    // The message can contain some data from the locked resource. But outside
+    // this method, we touch only the RCode of it, so it should be safe.
 }
 
 bool