diff options
author | Haavard <havardpe@yahoo-inc.com> | 2017-06-19 10:57:15 +0000 |
---|---|---|
committer | Haavard <havardpe@yahoo-inc.com> | 2017-06-20 09:22:34 +0000 |
commit | 812c0ac2c017923afd6dcb4474b295de43b21f9a (patch) | |
tree | f3fda66c78b1ad1d4cbe331ef7de2a2833df1c5d /searchcore/src | |
parent | 555b86fd88709d00b00f5f590c8024b739346bdf (diff) |
use lazy resolver in fdispatch
Diffstat (limited to 'searchcore/src')
4 files changed, 10 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp index d9645e56606..b9ed05603dd 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp @@ -22,7 +22,8 @@ FastS_TimeKeeper::~FastS_TimeKeeper() FastS_AppContext::FastS_AppContext() : _timeKeeper(), - _createTime() + _createTime(), + _lazy_resolver(vespalib::LazyResolver::create()) { _createTime = _timeKeeper.GetTime(); } diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h index 16c8c81bf05..2ba24de5b02 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h +++ b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h @@ -5,6 +5,7 @@ #pragma once #include <vespa/vespalib/util/clock.h> +#include <vespa/vespalib/net/lazy_resolver.h> class FastS_NodeManager; class FNET_Transport; @@ -31,12 +32,14 @@ class FastS_AppContext private: FastS_TimeKeeper _timeKeeper; double _createTime; + vespalib::LazyResolver::SP _lazy_resolver; public: FastS_AppContext(); virtual ~FastS_AppContext(); FastS_TimeKeeper *GetTimeKeeper() { return &_timeKeeper; } + vespalib::LazyResolver &get_lazy_resolver() { return *_lazy_resolver; } virtual FastS_NodeManager *GetNodeManager(); virtual FNET_Transport *GetFNETTransport(); diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.cpp index 5b444427c4d..3c2eb29e122 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.cpp @@ -61,7 +61,7 @@ FastS_FNET_Engine::Connect() _conn->GetState() >= FNET_Connection::FNET_CLOSING) { FNET_Connection *newConn = - _transport->Connect(_spec.c_str(), + _transport->Connect(_lazy_address->resolve().c_str(), &FS4PersistentPacketStreamer::Instance, this); LockDataSet(); @@ -95,6 +95,7 @@ FastS_FNET_Engine::FastS_FNET_Engine(FastS_EngineDesc *desc, : FastS_EngineBase(desc, dataset), _lock(), _spec(), + _lazy_address(), _transport(dataset->GetTransport()), _conn(NULL), _warnTask(dataset->GetAppContext()->GetFNETScheduler(), this), @@ -107,6 +108,7 @@ FastS_FNET_Engine::FastS_FNET_Engine(FastS_EngineDesc *desc, _spec = "tcp/"; _spec += _config._name; } + _lazy_address = dataset->GetAppContext()->get_lazy_resolver().make_address(_spec); } diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.h b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.h index 9f03f0319db..bf69ffa457b 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.h @@ -6,6 +6,7 @@ #include "engine_base.h" #include <vespa/searchlib/common/packets.h> #include <vespa/fnet/ipackethandler.h> +#include <vespa/vespalib/net/lazy_resolver.h> //---------------------------------------------------------------------- @@ -81,6 +82,7 @@ private: std::string _hostName; int _portNumber; std::string _spec; + vespalib::LazyResolver::Address::SP _lazy_address; FNET_Transport *_transport; FNET_Connection *_conn; WarnTask _warnTask; |