From 1e0886545cdb582528998d3d40d337ebd71ccc08 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 1 Dec 2020 14:47:06 +0000 Subject: Move config setters directly onto main TransportConfig object --- fnet/src/vespa/fnet/config.h | 19 ----------------- fnet/src/vespa/fnet/transport.h | 24 +++++++++++++++++----- .../src/vespa/messagebus/network/rpcnetwork.cpp | 7 ++++--- .../storageserver/rpc/shared_rpc_resources.cpp | 2 +- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/fnet/src/vespa/fnet/config.h b/fnet/src/vespa/fnet/config.h index 508cb26c36f..f512d7cde75 100644 --- a/fnet/src/vespa/fnet/config.h +++ b/fnet/src/vespa/fnet/config.h @@ -18,23 +18,4 @@ public: bool _tcpNoDelay; FNET_Config(); - FNET_Config & events_before_wakeup(uint32_t v) { - if (v > 1) { - _events_before_wakeup = v; - } - return *this; - } - FNET_Config & maxInputBufferSize(uint32_t v) { - _maxInputBufferSize = v; - return *this; - } - FNET_Config & maxOutputBufferSize(uint32_t v) { - _maxOutputBufferSize = v; - return *this; - } - FNET_Config & tcpNoDelay(bool v) { - _tcpNoDelay = v; - return *this; - } - }; diff --git a/fnet/src/vespa/fnet/transport.h b/fnet/src/vespa/fnet/transport.h index 6557c372a4d..766eaa3ccaa 100644 --- a/fnet/src/vespa/fnet/transport.h +++ b/fnet/src/vespa/fnet/transport.h @@ -32,13 +32,27 @@ public: _crypto = std::move(crypto_in); return *this; } - TransportConfig & config(const FNET_Config & config_in) { - _config = config_in; - return *this; - } const FNET_Config & config() const { return _config; } - FNET_Config & config() { return _config; } uint32_t num_threads() const { return _num_threads; } + + TransportConfig & events_before_wakeup(uint32_t v) { + if (v > 1) { + _config._events_before_wakeup = v; + } + return *this; + } + TransportConfig & maxInputBufferSize(uint32_t v) { + _config._maxInputBufferSize = v; + return *this; + } + TransportConfig & maxOutputBufferSize(uint32_t v) { + _config._maxOutputBufferSize = v; + return *this; + } + TransportConfig & tcpNoDelay(bool v) { + _config._tcpNoDelay = v; + return *this; + } private: FNET_Config _config; vespalib::AsyncResolver::SP _resolver; diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp index c286b056ae2..9ecc57fd9de 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp @@ -81,9 +81,10 @@ struct TargetPoolTask : public FNET_Task { TransportConfig toFNETConfig(const RPCNetworkParams & params) { - return TransportConfig().config(FNET_Config().maxInputBufferSize(params.getMaxInputBufferSize()) - .maxOutputBufferSize(params.getMaxOutputBufferSize()) - .tcpNoDelay(params.getTcpNoDelay())); + return TransportConfig() + .maxInputBufferSize(params.getMaxInputBufferSize()) + .maxOutputBufferSize(params.getMaxOutputBufferSize()) + .tcpNoDelay(params.getTcpNoDelay()); } } diff --git a/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp b/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp index 1b629f86f31..3aa3d21aa7b 100644 --- a/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp +++ b/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp @@ -64,7 +64,7 @@ SharedRpcResources::SharedRpcResources(const config::ConfigUri& config_uri, int rpc_server_port, size_t rpc_thread_pool_size) : _thread_pool(std::make_unique(1024*60)), - _transport(std::make_unique(TransportConfig(rpc_thread_pool_size).config(FNET_Config().events_before_wakeup(1)))), + _transport(std::make_unique(TransportConfig(rpc_thread_pool_size).events_before_wakeup(1))), _orb(std::make_unique(_transport.get())), _slobrok_register(std::make_unique(*_orb, slobrok::ConfiguratorFactory(config_uri))), _slobrok_mirror(std::make_unique(*_orb, slobrok::ConfiguratorFactory(config_uri))), -- cgit v1.2.3