From: Michal 'vorner' Vaner Date: Mon, 1 Oct 2012 13:44:02 +0000 (+0200) Subject: [2202] Don't release the lock until rendered X-Git-Tag: trac2402_base~79^2~5^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8bd4cd42e061d49d098cb1387b3614226a161f6d;p=thirdparty%2Fkea.git [2202] Don't release the lock until rendered 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. --- diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc index 9f6becff20..04dc299074 100644 --- a/src/bin/auth/auth_srv.cc +++ b/src/bin/auth/auth_srv.cc @@ -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 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