23 : query_(query), thread_(this_thread::get_id()) {
32 duid_ = client_id->getDuid();
35mutex ClientHandler::mutex_;
37ClientHandler::ClientContainer ClientHandler::clients_;
39ClientHandler::ClientPtr
40ClientHandler::lookup(
const DuidPtr& duid) {
46 auto it = clients_.find(duid->getDuid());
47 if (it == clients_.end()) {
54ClientHandler::add(
const ClientPtr& client) {
61 clients_.insert(client);
65ClientHandler::del(
const DuidPtr& duid) {
72 clients_.erase(duid->getDuid());
75ClientHandler::ClientHandler() : client_(), locked_() {
78ClientHandler::~ClientHandler() {
80 lock_guard<mutex> lk(mutex_);
95 const DuidPtr& duid = query->getClientId();
100 if (duid->getDuid().empty()) {
107 client_.reset(
new Client(query, duid));
111 lock_guard<mutex> lk(mutex_);
112 holder = lookup(duid);
120 next_query = holder->next_query_;
121 holder->next_query_ = query;
122 holder->cont_ = cont;
131 .arg(next_query->makeLabel(next_query->getClientId(),
nullptr))
132 .arg(next_query->toText())
133 .arg(this_thread::get_id())
134 .arg(holder->query_->makeLabel(holder->query_->getClientId(),
nullptr))
135 .arg(holder->query_->toText())
136 .arg(holder->thread_);
137 stats::StatsMgr::instance().addValue(
"pkt6-receive-drop",
138 static_cast<int64_t
>(1));
144 .arg(query->makeLabel(query->getClientId(),
nullptr))
145 .arg(query->toText())
146 .arg(this_thread::get_id())
147 .arg(holder->query_->makeLabel(holder->query_->getClientId(),
nullptr))
148 .arg(holder->query_->toText())
149 .arg(holder->thread_);
150 stats::StatsMgr::instance().addValue(
"pkt6-receive-drop",
151 static_cast<int64_t
>(1));
157ClientHandler::lock() {
167ClientHandler::unLock() {
176 if (!client_ || !client_->cont_) {
183 if (mt_mgr.getMode()) {
184 if (!mt_mgr.getThreadPool().addFront(client_->cont_)) {
185 LOG_DEBUG(dhcp6_logger, DBG_DHCP6_BASIC, DHCP6_PACKET_QUEUE_FULL);
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
A generic exception that is thrown when an unexpected error condition occurs.
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
isc::log::Logger bad_packet6_logger(DHCP6_BAD_PACKET_LOGGER_NAME)
Logger for rejected packets.
boost::shared_ptr< DUID > DuidPtr
boost::shared_ptr< Continuation > ContinuationPtr
Define the type of shared pointers to continuations.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
const isc::log::MessageID DHCP6_PACKET_DROP_DUPLICATE
const int DBGLVL_PKT_HANDLING
This debug level is reserved for logging the details of packet handling, such as dropping the packet ...
Defines the logger used by the top-level component of kea-lfc.