aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/src/vespa/config/frt/frtconnectionpool.cpp15
-rw-r--r--config/src/vespa/config/frt/frtconnectionpool.h9
-rw-r--r--config/src/vespa/config/frt/frtsourcefactory.cpp4
-rw-r--r--config/src/vespa/config/helper/legacy.cpp9
-rw-r--r--config/src/vespa/config/subscription/configuri.cpp14
-rw-r--r--config/src/vespa/config/subscription/configuri.h2
-rw-r--r--config/src/vespa/config/subscription/sourcespec.cpp37
-rw-r--r--config/src/vespa/config/subscription/sourcespec.h3
-rw-r--r--documentapi/src/tests/policies/testframe.cpp59
-rw-r--r--documentapi/src/tests/policies/testframe.h26
-rw-r--r--messagebus/src/vespa/messagebus/network/identity.cpp2
-rw-r--r--messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp8
-rw-r--r--messagebus/src/vespa/messagebus/network/rpcnetworkparams.h12
-rw-r--r--messagebus/src/vespa/messagebus/testlib/testserver.cpp8
14 files changed, 81 insertions, 127 deletions
diff --git a/config/src/vespa/config/frt/frtconnectionpool.cpp b/config/src/vespa/config/frt/frtconnectionpool.cpp
index fa5436621f8..4bea8062a03 100644
--- a/config/src/vespa/config/frt/frtconnectionpool.cpp
+++ b/config/src/vespa/config/frt/frtconnectionpool.cpp
@@ -11,7 +11,6 @@ FRTConnectionPool::FRTConnectionKey::FRTConnectionKey(int idx, const vespalib::s
: _idx(idx),
_hostname(hostname)
{
-
}
int
@@ -33,7 +32,7 @@ FRTConnectionPool::FRTConnectionPool(const ServerSpec & spec, const TimingValues
{
for (size_t i(0); i < spec.numHosts(); i++) {
FRTConnectionKey key(i, spec.getHost(i));
- _connections[key].reset(new FRTConnection(spec.getHost(i), *_supervisor, timingValues));
+ _connections[key] = std::make_shared<FRTConnection>(spec.getHost(i), *_supervisor, timingValues);
}
setHostname();
_supervisor->Start();
@@ -67,7 +66,7 @@ FRTConnectionPool::getNextRoundRobin()
getReadySources(readySources);
std::vector<FRTConnection *> suspendedSources;
getSuspendedSources(suspendedSources);
- FRTConnection* nextFRTConnection = NULL;
+ FRTConnection* nextFRTConnection = nullptr;
if (!readySources.empty()) {
int sel = _selectIdx % (int)readySources.size();
@@ -88,7 +87,7 @@ FRTConnectionPool::getNextHashBased()
getReadySources(readySources);
std::vector<FRTConnection*> suspendedSources;
getSuspendedSources(suspendedSources);
- FRTConnection* nextFRTConnection = NULL;
+ FRTConnection* nextFRTConnection = nullptr;
if (!readySources.empty()) {
int sel = std::abs(hashCode(_hostname) % (int)readySources.size());
@@ -104,8 +103,8 @@ const std::vector<FRTConnection *> &
FRTConnectionPool::getReadySources(std::vector<FRTConnection*> & readySources) const
{
readySources.clear();
- for (ConnectionMap::const_iterator iter = _connections.begin(); iter != _connections.end(); iter++) {
- FRTConnection* source = iter->second.get();
+ for (const auto & entry : _connections) {
+ FRTConnection* source = entry.second.get();
int64_t tnow = time(0);
tnow *= 1000;
int64_t timestamp = tnow;
@@ -120,8 +119,8 @@ const std::vector<FRTConnection *> &
FRTConnectionPool::getSuspendedSources(std::vector<FRTConnection*> & suspendedSources) const
{
suspendedSources.clear();
- for (ConnectionMap::const_iterator iter = _connections.begin(); iter != _connections.end(); iter++) {
- FRTConnection* source = iter->second.get();
+ for (const auto & entry : _connections) {
+ FRTConnection* source = entry.second.get();
int64_t tnow = time(0);
tnow *= 1000;
int64_t timestamp = tnow;
diff --git a/config/src/vespa/config/frt/frtconnectionpool.h b/config/src/vespa/config/frt/frtconnectionpool.h
index 0d9d480e3c1..e671c756db5 100644
--- a/config/src/vespa/config/frt/frtconnectionpool.h
+++ b/config/src/vespa/config/frt/frtconnectionpool.h
@@ -5,7 +5,6 @@
#include "connectionfactory.h"
#include <vespa/config/subscription/sourcespec.h>
#include <vector>
-#include <string>
#include <map>
namespace config {
@@ -13,8 +12,6 @@ namespace config {
class FRTConnectionPool : public ConnectionFactory {
private:
- FRTConnectionPool(const FRTConnectionPool&);
- FRTConnectionPool& operator=(const FRTConnectionPool&);
/**
* This class makes it possible to iterate over the entries in the
@@ -35,12 +32,14 @@ private:
std::unique_ptr<FRT_Supervisor> _supervisor;
int _selectIdx;
vespalib::string _hostname;
- typedef std::map<FRTConnectionKey, FRTConnection::SP> ConnectionMap;
+ using ConnectionMap = std::map<FRTConnectionKey, FRTConnection::SP>;
ConnectionMap _connections;
public:
FRTConnectionPool(const ServerSpec & spec, const TimingValues & timingValues);
- ~FRTConnectionPool();
+ FRTConnectionPool(const FRTConnectionPool&) = delete;
+ FRTConnectionPool& operator=(const FRTConnectionPool&) = delete;
+ ~FRTConnectionPool() override;
void syncTransport() override;
diff --git a/config/src/vespa/config/frt/frtsourcefactory.cpp b/config/src/vespa/config/frt/frtsourcefactory.cpp
index ef4f4ac07ed..c58571e3ac4 100644
--- a/config/src/vespa/config/frt/frtsourcefactory.cpp
+++ b/config/src/vespa/config/frt/frtsourcefactory.cpp
@@ -5,7 +5,7 @@
namespace config {
FRTSourceFactory::FRTSourceFactory(ConnectionFactory::UP connectionFactory, const TimingValues & timingValues, int protocolVersion, int traceLevel, const VespaVersion & vespaVersion, const CompressionType & compressionType)
- : _connectionFactory(connectionFactory.release()),
+ : _connectionFactory(std::move(connectionFactory)),
_requestFactory(protocolVersion, traceLevel, vespaVersion, compressionType),
_timingValues(timingValues)
{
@@ -14,7 +14,7 @@ FRTSourceFactory::FRTSourceFactory(ConnectionFactory::UP connectionFactory, cons
Source::UP
FRTSourceFactory::createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const
{
- return Source::UP(new FRTSource(_connectionFactory, _requestFactory, ConfigAgent::UP(new FRTConfigAgent(holder, _timingValues)), key));
+ return std::make_unique<FRTSource>(_connectionFactory, _requestFactory, std::make_unique<FRTConfigAgent>(holder, _timingValues), key);
}
} // namespace config
diff --git a/config/src/vespa/config/helper/legacy.cpp b/config/src/vespa/config/helper/legacy.cpp
index 32ce98bfb6a..f3e73a602e4 100644
--- a/config/src/vespa/config/helper/legacy.cpp
+++ b/config/src/vespa/config/helper/legacy.cpp
@@ -41,15 +41,14 @@ isLegacyConfigId(const std::string & configId)
std::unique_ptr<SourceSpec>
legacyConfigId2Spec(const std::string & configId)
{
- std::unique_ptr<SourceSpec> spec(new ServerSpec());
if (isFileLegacy(configId)) {
- spec.reset(new FileSpec(createFileSpecFromId(configId)));
+ return std::make_unique<FileSpec>(createFileSpecFromId(configId));
} else if (isDirLegacy(configId)) {
- spec.reset(new DirSpec(dirNameFromId(configId)));
+ return std::make_unique<DirSpec>(dirNameFromId(configId));
} else if (isRawLegacy(configId)) {
- spec.reset(new RawSpec(createRawSpecFromId(configId)));
+ return std::make_unique<RawSpec>(createRawSpecFromId(configId));
}
- return spec;
+ return std::make_unique<ServerSpec>();
}
const std::string
diff --git a/config/src/vespa/config/subscription/configuri.cpp b/config/src/vespa/config/subscription/configuri.cpp
index 293093b307a..041a840c548 100644
--- a/config/src/vespa/config/subscription/configuri.cpp
+++ b/config/src/vespa/config/subscription/configuri.cpp
@@ -13,19 +13,19 @@ namespace config {
ConfigUri::ConfigUri(const vespalib::string &configId)
: _configId(legacyConfigId2ConfigId(configId)),
- _context(new ConfigContext(*legacyConfigId2Spec(configId))),
+ _context(std::make_shared<ConfigContext>(*legacyConfigId2Spec(configId))),
_empty(checkEmpty(configId))
{
}
-ConfigUri::ConfigUri(const vespalib::string &configId, const IConfigContext::SP & context)
+ConfigUri::ConfigUri(const vespalib::string &configId, IConfigContext::SP context)
: _configId(configId),
- _context(context),
+ _context(std::move(context)),
_empty(false)
{
}
-ConfigUri::~ConfigUri() { }
+ConfigUri::~ConfigUri() = default;
ConfigUri
ConfigUri::createWithNewId(const vespalib::string & configId) const
@@ -39,20 +39,20 @@ const IConfigContext::SP & ConfigUri::getContext() const { return _context; }
ConfigUri
ConfigUri::createFromInstance(const ConfigInstance & instance)
{
- return ConfigUri("", IConfigContext::SP(new ConfigContext(ConfigInstanceSpec(instance))));
+ return ConfigUri("", std::make_shared<ConfigContext>(ConfigInstanceSpec(instance)));
}
ConfigUri
ConfigUri::createEmpty()
{
- ConfigUri uri("", IConfigContext::SP(new ConfigContext(RawSpec(""))));
+ ConfigUri uri("", std::make_shared<ConfigContext>(RawSpec("")));
uri._empty = true;
return uri;
}
ConfigUri ConfigUri::createFromSpec(const vespalib::string& configId, const SourceSpec& spec)
{
- return ConfigUri(configId, IConfigContext::SP(new ConfigContext(spec)));
+ return ConfigUri(configId, std::make_shared<ConfigContext>(spec));
}
diff --git a/config/src/vespa/config/subscription/configuri.h b/config/src/vespa/config/subscription/configuri.h
index a81be8c3359..11a4fcf4990 100644
--- a/config/src/vespa/config/subscription/configuri.h
+++ b/config/src/vespa/config/subscription/configuri.h
@@ -46,7 +46,7 @@ public:
* @param configId The config id.
* @param context A context object that can be shared with multiple URIs.
*/
- ConfigUri(const vespalib::string &configId, const IConfigContext::SP & context);
+ ConfigUri(const vespalib::string &configId, IConfigContext::SP context);
~ConfigUri();
diff --git a/config/src/vespa/config/subscription/sourcespec.cpp b/config/src/vespa/config/subscription/sourcespec.cpp
index 586344ef9e3..30926d75465 100644
--- a/config/src/vespa/config/subscription/sourcespec.cpp
+++ b/config/src/vespa/config/subscription/sourcespec.cpp
@@ -11,7 +11,6 @@
#include <vespa/vespalib/text/stringtokenizer.h>
#include <vespa/config/print/asciiconfigwriter.h>
-
namespace config {
class BuilderMap : public std::map<ConfigKey, ConfigInstance *> {
@@ -25,10 +24,9 @@ RawSpec::RawSpec(const vespalib::string & config)
}
SourceFactory::UP
-RawSpec::createSourceFactory(const TimingValues & timingValues) const
+RawSpec::createSourceFactory(const TimingValues &) const
{
- (void) timingValues;
- return SourceFactory::UP(new RawSourceFactory(_config));
+ return std::make_unique<RawSourceFactory>(_config);
}
FileSpec::FileSpec(const vespalib::string & fileName)
@@ -50,10 +48,9 @@ FileSpec::verifyName(const vespalib::string & fileName)
}
SourceFactory::UP
-FileSpec::createSourceFactory(const TimingValues & timingValues) const
+FileSpec::createSourceFactory(const TimingValues & ) const
{
- (void) timingValues;
- return SourceFactory::UP(new FileSourceFactory(*this));
+ return std::make_unique<FileSourceFactory>(*this);
}
DirSpec::DirSpec(const vespalib::string & dirName)
@@ -62,10 +59,9 @@ DirSpec::DirSpec(const vespalib::string & dirName)
}
SourceFactory::UP
-DirSpec::createSourceFactory(const TimingValues & timingValues) const
+DirSpec::createSourceFactory(const TimingValues & ) const
{
- (void) timingValues;
- return SourceFactory::UP(new DirSourceFactory(*this));
+ return std::make_unique<DirSourceFactory>(*this);
}
ServerSpec::ServerSpec()
@@ -75,7 +71,7 @@ ServerSpec::ServerSpec()
_compressionType(protocol::readProtocolCompressionType())
{
char* cfgSourcesPtr = getenv("VESPA_CONFIG_SOURCES");
- if (cfgSourcesPtr != NULL) {
+ if (cfgSourcesPtr != nullptr) {
vespalib::string cfgSourcesStr(cfgSourcesPtr);
initialize(cfgSourcesStr);
} else {
@@ -89,7 +85,7 @@ ServerSpec::initialize(const vespalib::string & hostSpec)
typedef vespalib::StringTokenizer tokenizer;
tokenizer tok(hostSpec, ",");
for (tokenizer::Iterator it = tok.begin(); it != tok.end(); it++) {
- std::string srcHost = *it;
+ vespalib::string srcHost = *it;
vespalib::asciistream spec;
if (srcHost.find("tcp/") == std::string::npos) {
spec << "tcp/";
@@ -123,26 +119,26 @@ SourceFactory::UP
ServerSpec::createSourceFactory(const TimingValues & timingValues) const
{
const auto vespaVersion = VespaVersion::getCurrentVersion();
- return SourceFactory::UP(new FRTSourceFactory(ConnectionFactory::UP(new FRTConnectionPool(*this, timingValues)), timingValues, _protocolVersion, _traceLevel, vespaVersion, _compressionType));
+ return std::make_unique<FRTSourceFactory>(std::make_unique<FRTConnectionPool>(*this, timingValues), timingValues,
+ _protocolVersion, _traceLevel, vespaVersion, _compressionType);
}
ConfigSet::ConfigSet()
- : _builderMap(new BuilderMap())
+ : _builderMap(std::make_unique<BuilderMap>())
{
}
SourceFactory::UP
-ConfigSet::createSourceFactory(const TimingValues & timingValues) const
+ConfigSet::createSourceFactory(const TimingValues & ) const
{
- (void) timingValues;
- return SourceFactory::UP(new ConfigSetSourceFactory(_builderMap));
+ return std::make_unique<ConfigSetSourceFactory>(_builderMap);
}
void
ConfigSet::addBuilder(const vespalib::string & configId, ConfigInstance * builder)
{
- assert(builder != NULL);
+ assert(builder != nullptr);
BuilderMap & builderMap(*_builderMap);
const ConfigKey key(configId, builder->defName(), builder->defNamespace(), builder->defMd5());
builderMap[key] = builder;
@@ -157,10 +153,9 @@ ConfigInstanceSpec::ConfigInstanceSpec(const ConfigInstance& instance)
}
SourceFactory::UP
-ConfigInstanceSpec::createSourceFactory(const TimingValues& timingValues) const
+ConfigInstanceSpec::createSourceFactory(const TimingValues& ) const
{
- (void) timingValues;
- return SourceFactory::UP(new ConfigInstanceSourceFactory(_key, _buffer));
+ return std::make_unique<ConfigInstanceSourceFactory>(_key, _buffer);
}
diff --git a/config/src/vespa/config/subscription/sourcespec.h b/config/src/vespa/config/subscription/sourcespec.h
index dc1a26c3f97..22db2368c01 100644
--- a/config/src/vespa/config/subscription/sourcespec.h
+++ b/config/src/vespa/config/subscription/sourcespec.h
@@ -153,8 +153,7 @@ public:
*/
ServerSpec(const vespalib::string & hostSpec);
- // Implements SourceSpec
- virtual SourceFactorySP createSourceFactory(const TimingValues & timingValues) const override;
+ SourceFactorySP createSourceFactory(const TimingValues & timingValues) const override;
/**
* Add another host to this source spec, allowing failover.
diff --git a/documentapi/src/tests/policies/testframe.cpp b/documentapi/src/tests/policies/testframe.cpp
index d99d99b9ec0..4cdc5d4ba14 100644
--- a/documentapi/src/tests/policies/testframe.cpp
+++ b/documentapi/src/tests/policies/testframe.cpp
@@ -20,14 +20,9 @@ private:
string _address;
public:
- MyServiceAddress(const string &address) :
- _address(address) {
- // empty
- }
+ MyServiceAddress(const string &address) : _address(address) {}
- const string &getAddress() {
- return _address;
- }
+ const string &getAddress() { return _address; }
};
class MyNetwork : public mbus::RPCNetwork {
@@ -37,13 +32,12 @@ private:
public:
MyNetwork(const mbus::RPCNetworkParams &params) :
mbus::RPCNetwork(params),
- _nodes() {
- // empty
- }
+ _nodes()
+ { }
bool allocServiceAddress(mbus::RoutingNode &recipient) override {
string hop = recipient.getRoute().getHop(0).toString();
- recipient.setServiceAddress(mbus::IServiceAddress::UP(new MyServiceAddress(hop)));
+ recipient.setServiceAddress(std::make_unique<MyServiceAddress>(hop));
return true;
}
@@ -63,18 +57,14 @@ public:
TestFrame::TestFrame(const std::shared_ptr<const DocumentTypeRepo> &repo, const string &ident) :
_identity(ident),
- _slobrok(new mbus::Slobrok()),
+ _slobrok(std::make_shared<mbus::Slobrok>()),
_set(),
- _net(new MyNetwork(mbus::RPCNetworkParams()
- .setIdentity(mbus::Identity(ident))
- .setSlobrokConfig(_slobrok->config()))),
- _mbus(new mbus::MessageBus(*_net, mbus::MessageBusParams()
- .addProtocol(mbus::IProtocol::SP(new DocumentProtocol(_set, repo))))),
+ _net(std::make_shared<MyNetwork>(mbus::RPCNetworkParams(_slobrok->config()).setIdentity(mbus::Identity(ident)))),
+ _mbus(std::make_shared<mbus::MessageBus>(*_net, mbus::MessageBusParams().addProtocol(std::make_shared<DocumentProtocol>(_set, repo)))),
_msg(),
_hop(mbus::HopSpec("foo", "bar")),
_handler()
{
- // empty
}
TestFrame::TestFrame(TestFrame &frame) :
@@ -87,13 +77,9 @@ TestFrame::TestFrame(TestFrame &frame) :
_hop(mbus::HopSpec("baz", "cox")),
_handler()
{
- // empty
}
-TestFrame::~TestFrame()
-{
- // empty
-}
+TestFrame::~TestFrame() = default;
void
TestFrame::setHop(const mbus::HopSpec &hop)
@@ -107,7 +93,7 @@ TestFrame::select(std::vector<mbus::RoutingNode*> &selected, uint32_t numExpecte
{
_msg->setRoute(mbus::Route::parse(_hop.getName()));
_msg->pushHandler(*this);
- mbus::SendProxy &proxy = *(new mbus::SendProxy(*_mbus, *_net, NULL)); // deletes self
+ mbus::SendProxy &proxy = *(new mbus::SendProxy(*_mbus, *_net, nullptr)); // deletes self
proxy.handleMessage(std::move(_msg));
static_cast<MyNetwork&>(*_net).removeNodes(selected);
@@ -125,21 +111,18 @@ TestFrame::testSelect(const std::vector<string> &expected)
if (!select(selected, expected.size())) {
LOG(error, "Failed to select recipients.");
for (size_t i = 0; i < selected.size(); ++i) {
- LOG(error, "Selected: %s",
- selected[i]->getRoute().toString().c_str());
+ LOG(error, "Selected: %s", selected[i]->getRoute().toString().c_str());
}
return false;
}
- for (std::vector<mbus::RoutingNode*>::iterator it = selected.begin();
- it != selected.end(); ++it)
- {
- string route = (*it)->getRoute().toString();
+ for (mbus::RoutingNode* node : selected) {
+ string route = node->getRoute().toString();
if (find(expected.begin(), expected.end(), route) == expected.end()) {
LOG(error, "Recipient '%s' not selected.", route.c_str());
}
- (*it)->handleReply(mbus::Reply::UP(new mbus::EmptyReply()));
+ node->handleReply(std::make_unique<mbus::EmptyReply>());
}
- if (_handler.getReply(600).get() == NULL) {
+ if (_handler.getReply(600).get() == nullptr) {
LOG(error, "Reply not propagated to handler.");
return false;
}
@@ -168,25 +151,23 @@ TestFrame::testMerge(const ReplyMap &replies,
return false;
}
- for (std::vector<mbus::RoutingNode*>::iterator it = selected.begin();
- it != selected.end(); ++it)
- {
- string route = (*it)->getRoute().toString();
+ for (mbus::RoutingNode* node : selected) {
+ string route = node->getRoute().toString();
ReplyMap::const_iterator mip = replies.find(route);
if (mip == replies.end()) {
LOG(error, "Recipient '%s' not expected.", route.c_str());
return false;
}
- mbus::Reply::UP ret(new mbus::SimpleReply(route));
+ auto ret = std::make_unique<mbus::SimpleReply>(route);
if (mip->second != mbus::ErrorCode::NONE) {
ret->addError(mbus::Error(mip->second, route));
}
- (*it)->handleReply(std::move(ret));
+ node->handleReply(std::move(ret));
}
mbus::Reply::UP reply = _handler.getReply(600);
- if (reply.get() == NULL) {
+ if (reply.get() == nullptr) {
LOG(error, "Reply not propagated to handler.");
return false;
}
diff --git a/documentapi/src/tests/policies/testframe.h b/documentapi/src/tests/policies/testframe.h
index cc5101905a1..4f4dfa7e2a8 100644
--- a/documentapi/src/tests/policies/testframe.h
+++ b/documentapi/src/tests/policies/testframe.h
@@ -13,16 +13,14 @@ using documentapi::string;
class TestFrame : public mbus::IReplyHandler {
private:
- string _identity;
+ string _identity;
std::shared_ptr<mbus::Slobrok> _slobrok;
- documentapi::LoadTypeSet _set;
+ documentapi::LoadTypeSet _set;
std::shared_ptr<mbus::INetwork> _net;
std::shared_ptr<mbus::MessageBus> _mbus;
- mbus::Message::UP _msg;
- mbus::HopSpec _hop;
- mbus::Receptor _handler;
-
- TestFrame &operator=(const TestFrame &); // hide
+ mbus::Message::UP _msg;
+ mbus::HopSpec _hop;
+ mbus::Receptor _handler;
public:
/**
@@ -38,6 +36,8 @@ public:
TestFrame(const std::shared_ptr<const document::DocumentTypeRepo> &repo,
const string &ident = "anonymous");
+ TestFrame &operator=(const TestFrame &) = delete;
+
/**
* Create a test frame running on the same slobrok and mbus as another.
*
@@ -45,10 +45,7 @@ public:
*/
TestFrame(TestFrame &frame);
- /**
- * Cleans up allocated resources.
- */
- virtual ~TestFrame();
+ ~TestFrame() override;
/**
* Routes the contained message based on the current setup, and returns the leaf send contexts.
@@ -137,13 +134,6 @@ public:
const string &getIdentity() { return _identity; }
/**
- * Returns the private slobrok server.
- *
- * @return The slobrok.
- */
- mbus::Slobrok &getSlobrok() { return *_slobrok; }
-
- /**
* Returns the private message bus.
*
* @return The bus.
diff --git a/messagebus/src/vespa/messagebus/network/identity.cpp b/messagebus/src/vespa/messagebus/network/identity.cpp
index 9bc6e2ab657..17424c1b8a3 100644
--- a/messagebus/src/vespa/messagebus/network/identity.cpp
+++ b/messagebus/src/vespa/messagebus/network/identity.cpp
@@ -12,7 +12,7 @@ Identity::Identity(const string &configId) :
_hostname = vespalib::HostName::get();
}
-Identity::~Identity() {}
+Identity::~Identity() = default;
std::vector<string>
Identity::split(const string &name)
diff --git a/messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp b/messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp
index b6f0231e619..bd87e4dbbe2 100644
--- a/messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp
+++ b/messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp
@@ -4,9 +4,13 @@
namespace mbus {
-RPCNetworkParams::RPCNetworkParams() :
+RPCNetworkParams::RPCNetworkParams()
+ : RPCNetworkParams("admin/slobrok.0")
+{ }
+
+RPCNetworkParams::RPCNetworkParams(config::ConfigUri configUri) :
_identity(Identity("")),
- _slobrokConfig("admin/slobrok.0"),
+ _slobrokConfig(std::move(configUri)),
_listenPort(0),
_maxInputBufferSize(256*1024),
_maxOutputBufferSize(256*1024),
diff --git a/messagebus/src/vespa/messagebus/network/rpcnetworkparams.h b/messagebus/src/vespa/messagebus/network/rpcnetworkparams.h
index 1dcc8178e68..d2529ea301d 100644
--- a/messagebus/src/vespa/messagebus/network/rpcnetworkparams.h
+++ b/messagebus/src/vespa/messagebus/network/rpcnetworkparams.h
@@ -27,6 +27,7 @@ private:
public:
RPCNetworkParams();
+ RPCNetworkParams(config::ConfigUri configUri);
~RPCNetworkParams();
/**
@@ -69,17 +70,6 @@ public:
}
/**
- * Sets of the slobrok config.
- *
- * @param slobrokConfigId The new config.
- * @return This, to allow chaining.
- */
- RPCNetworkParams &setSlobrokConfig(const config::ConfigUri & slobrokConfig) {
- _slobrokConfig = slobrokConfig;
- return *this;
- }
-
- /**
* Returns the port to listen to.
*
* @return The port.
diff --git a/messagebus/src/vespa/messagebus/testlib/testserver.cpp b/messagebus/src/vespa/messagebus/testlib/testserver.cpp
index a2489aac9ce..bbd23d52c0b 100644
--- a/messagebus/src/vespa/messagebus/testlib/testserver.cpp
+++ b/messagebus/src/vespa/messagebus/testlib/testserver.cpp
@@ -23,10 +23,8 @@ TestServer::TestServer(const Identity &ident,
const RoutingSpec &spec,
const Slobrok &slobrok,
IProtocol::SP protocol) :
- net(RPCNetworkParams()
- .setIdentity(ident)
- .setSlobrokConfig(slobrok.config())),
- mb(net, ProtocolSet().add(IProtocol::SP(new SimpleProtocol())).add(protocol))
+ net(RPCNetworkParams(slobrok.config()).setIdentity(ident)),
+ mb(net, ProtocolSet().add(std::make_shared<SimpleProtocol>()).add(protocol))
{
mb.setupRouting(spec);
}
@@ -37,7 +35,7 @@ TestServer::TestServer(const MessageBusParams &mbusParams,
mb(net, mbusParams)
{}
-TestServer::~TestServer() {}
+TestServer::~TestServer() = default;
bool
TestServer::waitSlobrok(const string &pattern, uint32_t cnt)