summaryrefslogtreecommitdiffstats
path: root/src/lib/util/reconnect_ctl.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:36:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:36:04 +0000
commit040eee1aa49b49df4698d83a05af57c220127fd1 (patch)
treef635435954e6ccde5eee9893889e24f30ca68346 /src/lib/util/reconnect_ctl.cc
parentInitial commit. (diff)
downloadisc-kea-upstream.tar.xz
isc-kea-upstream.zip
Adding upstream version 2.2.0.upstream/2.2.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib/util/reconnect_ctl.cc')
-rw-r--r--src/lib/util/reconnect_ctl.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/lib/util/reconnect_ctl.cc b/src/lib/util/reconnect_ctl.cc
new file mode 100644
index 0000000..265ff2f
--- /dev/null
+++ b/src/lib/util/reconnect_ctl.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <config.h>
+#include <util/reconnect_ctl.h>
+#include <exceptions/exceptions.h>
+
+namespace isc {
+namespace util {
+
+std::string
+ReconnectCtl::onFailActionToText(OnFailAction action) {
+ switch (action) {
+ case OnFailAction::STOP_RETRY_EXIT:
+ return ("stop-retry-exit");
+ case OnFailAction::SERVE_RETRY_EXIT:
+ return ("serve-retry-exit");
+ case OnFailAction::SERVE_RETRY_CONTINUE:
+ return ("serve-retry-continue");
+ }
+ return ("invalid-action-type");
+}
+
+OnFailAction
+ReconnectCtl::onFailActionFromText(const std::string& text) {
+ if (text == "stop-retry-exit") {
+ return (OnFailAction::STOP_RETRY_EXIT);
+ } else if (text == "serve-retry-exit") {
+ return (OnFailAction::SERVE_RETRY_EXIT);
+ } else if (text == "serve-retry-continue") {
+ return (OnFailAction::SERVE_RETRY_CONTINUE);
+ } else {
+ isc_throw(BadValue, "Invalid action on connection loss: " << text);
+ }
+}
+
+}
+}