Skip to content

Commit df35252

Browse files
author
Razvan Becheriu
committed
[#3721] addressed review comments
1 parent 0f001c1 commit df35252

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

ChangeLog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
The kea-dhcp4, kea-dhcp6 and kea-dhcp-ddns servers now support
33
multiple http/https connections. The can be configured in the
44
"control-sockets" list.
5-
(Gitlab #3082)
5+
(Gitlab #3082, #3721)
66

77
2315. [func] razvan
88
Kea can now load hook libraries specifying only the binary name.

src/bin/agent/ca_process.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ CtrlAgentProcess::configure(isc::data::ConstElementPtr config_set,
152152
.arg(server_port);
153153
}
154154
}
155+
// If the connection can be reused, mark it as usable.
155156
it->second->usable_ = true;
156157
} else {
157158

@@ -210,8 +211,12 @@ CtrlAgentProcess::configure(isc::data::ConstElementPtr config_set,
210211
auto copy = sockets_;
211212
for (auto const& data : copy) {
212213
if (data.second->usable_) {
214+
// If the connection can be used (just created) or reused, keep it
215+
// in the list and clear the flag. It will be marked again on next
216+
// configuration event if needed.
213217
data.second->usable_ = false;
214218
} else {
219+
// If the connection can not be reused, stop it and remove it from the list.
215220
data.second->listener_->stop();
216221
auto it = sockets_.find(std::make_pair(data.second->config_->getHttpHost(),
217222
data.second->config_->getHttpPort()));

src/lib/config/http_command_mgr.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ HttpCommandMgrImpl::openCommandSockets(const isc::data::ConstElementPtr config)
102102
auto copy = sockets_;
103103
for (auto const& data : copy) {
104104
if (data.second->usable_) {
105+
// If the connection can be used (just created) or reused, keep it
106+
// in the list and clear the flag. It will be marked again on next
107+
// configuration event if needed.
105108
data.second->usable_ = false;
106109
} else {
110+
// If the connection can not be reused, stop it and remove it from the list.
107111
closeCommandSocket(data.second, true);
108112
}
109113
}
@@ -133,6 +137,7 @@ HttpCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr config) {
133137
it->second->config_->setAuthConfig(cmd_config->getAuthConfig());
134138
it->second->config_->setEmulateAgentResponse(cmd_config->getEmulateAgentResponse());
135139
}
140+
// If the connection can be reused, mark it as usable.
136141
it->second->usable_ = true;
137142
return;
138143
}

src/lib/config/unix_command_mgr.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,12 @@ UnixCommandMgrImpl::openCommandSockets(const isc::data::ConstElementPtr config)
574574
auto copy = sockets_;
575575
for (auto const& data : copy) {
576576
if (data.second->usable_) {
577+
// If the connection can be used (just created) or reused, keep it
578+
// in the list and clear the flag. It will be marked again on next
579+
// configuration event if needed.
577580
data.second->usable_ = false;
578581
} else {
582+
// If the connection can not be reused, stop it and remove it from the list.
579583
closeCommandSocket(data.second);
580584
}
581585
}
@@ -592,6 +596,7 @@ UnixCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr config) {
592596
// Search for the specific connection and reuse the existing one if found.
593597
auto it = sockets_.find(cmd_config->getSocketName());
594598
if (it != sockets_.end()) {
599+
// If the connection can be reused, mark it as usable.
595600
it->second->usable_ = true;
596601
return;
597602
}

0 commit comments

Comments
 (0)