summaryrefslogtreecommitdiffstats
path: root/configd/src/apps/sentinel/rpcserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'configd/src/apps/sentinel/rpcserver.cpp')
-rw-r--r--configd/src/apps/sentinel/rpcserver.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/configd/src/apps/sentinel/rpcserver.cpp b/configd/src/apps/sentinel/rpcserver.cpp
new file mode 100644
index 00000000000..b719d012304
--- /dev/null
+++ b/configd/src/apps/sentinel/rpcserver.cpp
@@ -0,0 +1,29 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "rpcserver.h"
+
+#include <vespa/log/log.h>
+LOG_SETUP(".rpcserver");
+
+namespace config::sentinel {
+
+RpcServer::RpcServer(int portNumber, CommandQueue &cmdQ)
+ : _supervisor(),
+ _rpcHooks(cmdQ),
+ _port(portNumber)
+{
+ _rpcHooks.initRPC(&_supervisor);
+ if (_supervisor.Listen(portNumber)) {
+ LOG(config, "listening on port %d", portNumber);
+ _supervisor.Start();
+ } else {
+ LOG(error, "unable to listen to port %d", portNumber);
+ }
+}
+
+RpcServer::~RpcServer()
+{
+ _supervisor.ShutDown(true);
+}
+
+} // namespace config::sentinel