aboutsummaryrefslogtreecommitdiffstats
path: root/logd
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-05-10 11:25:48 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-05-10 12:25:38 +0000
commit4412aace869986be3a1060f78f367841353d3384 (patch)
treef4b5e1f6da5eaf1563f3b2fd64779800acfd5796 /logd
parent840d4e0578dc627b75bcd0050f1b253e84cc30ed (diff)
Simplify the supervisor responsibility
Diffstat (limited to 'logd')
-rw-r--r--logd/src/logd/config_subscriber.cpp6
-rw-r--r--logd/src/logd/config_subscriber.h3
-rw-r--r--logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp26
3 files changed, 13 insertions, 22 deletions
diff --git a/logd/src/logd/config_subscriber.cpp b/logd/src/logd/config_subscriber.cpp
index ddcfcd38aae..7981e13a9a1 100644
--- a/logd/src/logd/config_subscriber.cpp
+++ b/logd/src/logd/config_subscriber.cpp
@@ -100,12 +100,11 @@ ConfigSubscriber::ConfigSubscriber(const config::ConfigUri& configUri)
_handle(),
_has_available(false),
_need_new_forwarder(true),
- _supervisor()
+ _server()
{
_handle = _subscriber.subscribe<LogdConfig>(configUri.getConfigId());
_subscriber.nextConfig(0);
configure(_handle->getConfig());
- _supervisor.Start();
LOG(debug, "got logServer %s", _logserver_host.c_str());
LOG(debug, "got handle %p", _handle.get());
@@ -113,7 +112,6 @@ ConfigSubscriber::ConfigSubscriber(const config::ConfigUri& configUri)
ConfigSubscriber::~ConfigSubscriber()
{
- _supervisor.ShutDown(true);
LOG(debug, "forget logServer %s", _logserver_host.c_str());
LOG(debug, "done ~ConfSub()");
}
@@ -123,7 +121,7 @@ ConfigSubscriber::make_forwarder(Metrics& metrics)
{
std::unique_ptr<Forwarder> result;
if (_use_logserver) {
- result = std::make_unique<RpcForwarder>(metrics, _forward_filter, _supervisor, _logserver_host,
+ result = std::make_unique<RpcForwarder>(metrics, _forward_filter, _server.supervisor(), _logserver_host,
_logserver_rpc_port, 60.0, 100);
} else {
result = std::make_unique<EmptyForwarder>(metrics);
diff --git a/logd/src/logd/config_subscriber.h b/logd/src/logd/config_subscriber.h
index 4d0938dfa3b..a60dac4a367 100644
--- a/logd/src/logd/config_subscriber.h
+++ b/logd/src/logd/config_subscriber.h
@@ -28,8 +28,7 @@ private:
config::ConfigHandle<cloud::config::log::LogdConfig>::UP _handle;
bool _has_available;
bool _need_new_forwarder;
- FRT_Supervisor _supervisor;
-
+ fnet::frt::StandaloneFRT _server;
public:
bool checkAvailable();
void latch();
diff --git a/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp b/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp
index 5b70434e793..92a641f639e 100644
--- a/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp
+++ b/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp
@@ -31,7 +31,7 @@ decode_log_request(FRT_Values& src, ProtoConverter::ProtoLogRequest& dst)
std::string garbage("garbage");
struct RpcServer : public FRT_Invokable {
- FRT_Supervisor supervisor;
+ fnet::frt::StandaloneFRT server;
int request_count;
std::vector<std::string> messages;
bool reply_with_error;
@@ -39,23 +39,20 @@ struct RpcServer : public FRT_Invokable {
public:
RpcServer()
- : supervisor(),
+ : server(),
request_count(0),
messages(),
reply_with_error(false),
reply_with_proto_response(true)
{
- supervisor.Listen(0);
- FRT_ReflectionBuilder builder(&supervisor);
+ server.supervisor().Listen(0);
+ FRT_ReflectionBuilder builder(&server.supervisor());
builder.DefineMethod("vespa.logserver.archiveLogMessages", "bix", "bix",
FRT_METHOD(RpcServer::rpc_archive_log_messages), this);
- supervisor.Start();
- }
- ~RpcServer() {
- supervisor.ShutDown(true);
}
+ ~RpcServer() = default;
int get_listen_port() {
- return supervisor.GetListenPort();
+ return server.supervisor().GetListenPort();
}
void rpc_archive_log_messages(FRT_RPCRequest* request) {
ProtoConverter::ProtoLogRequest proto_request;
@@ -96,17 +93,14 @@ struct MockMetricsManager : public DummyMetricsManager {
class ClientSupervisor {
private:
- FRT_Supervisor _supervisor;
+ fnet::frt::StandaloneFRT _client;
public:
ClientSupervisor()
- : _supervisor()
+ : _client()
{
- _supervisor.Start();
- }
- ~ClientSupervisor() {
- _supervisor.ShutDown(true);
}
- FRT_Supervisor& get() { return _supervisor; }
+ ~ClientSupervisor() = default;
+ FRT_Supervisor& get() { return _client.supervisor(); }
};