From: Razvan Becheriu Date: Mon, 8 Dec 2025 16:36:38 +0000 (+0200) Subject: [#4248] add log messages X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=852aaa2eb2b8a9f1c8feadb025adeca0c441de36;p=thirdparty%2Fkea.git [#4248] add log messages --- diff --git a/config-report.sh.in b/config-report.sh.in index 9b13c6f578..a7ead344ec 100755 --- a/config-report.sh.in +++ b/config-report.sh.in @@ -57,8 +57,8 @@ HERE_DOCUMENT add_to_report < #include #include +#include +#include #include #include #include @@ -332,11 +334,11 @@ IfaceMgr::addExternalSocket(int socketfd, SocketCallback callback) { isc_throw(BadValue, "Attempted to install callback for invalid socket " << socketfd); } - // @todo: remove comment when exclusively allow external sockets actions on main thread. - //if (std::this_thread::get_id() != id_) { - // isc_throw(InvalidOperation, "Attempted to register external socket from different thread " - // << std::this_thread::get_id()); - //} + if (std::this_thread::get_id() != id_) { + LOG_ERROR(dhcp_logger, DHCP_ADD_EXTERNAL_SOCKET) + .arg(socketfd) + .arg(std::this_thread::get_id()); + } std::lock_guard lock(callbacks_mutex_); for (SocketCallbackInfo& s : callbacks_) { // There's such a socket description there already. @@ -363,11 +365,11 @@ IfaceMgr::deleteExternalSocket(int socketfd) { void IfaceMgr::deleteExternalSocketInternal(int socketfd) { - // @todo: remove comment when exclusively allow external sockets actions on main thread. - //if (std::this_thread::get_id() != id_) { - // isc_throw(InvalidOperation, "Attempted to unregister external socket from different thread " - // << std::this_thread::get_id()); - //} + if (std::this_thread::get_id() != id_) { + LOG_ERROR(dhcp_logger, DHCP_DELETE_EXTERNAL_SOCKET) + .arg(socketfd) + .arg(std::this_thread::get_id()); + } for (SocketCallbackInfoContainer::iterator s = callbacks_.begin(); s != callbacks_.end(); ++s) { if (s->socket_ == socketfd) { @@ -403,11 +405,10 @@ IfaceMgr::isExternalSocketUnusable(int fd) { void IfaceMgr::deleteAllExternalSockets() { - // @todo: remove comment when exclusively allow external sockets actions on main thread. - //if (std::this_thread::get_id() != id_) { - // isc_throw(InvalidOperation, "Attempted to unregister external sockets from different thread " - // << std::this_thread::get_id()); - //} + if (std::this_thread::get_id() != id_) { + LOG_ERROR(dhcp_logger, DHCP_DELETE_ALL_EXTERNAL_SOCKETS) + .arg(std::this_thread::get_id()); + } std::lock_guard lock(callbacks_mutex_); callbacks_.clear(); }