summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-12-21 11:15:48 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-12-21 11:15:48 +0000
commitc69220b1397c1b02f1e5af99cedebd9f4d70ac61 (patch)
tree67e0231689513a05a2a468d2f64c64d9316eb10e /config
parent925370f4cfa32f1ace7e3ec70d7817277a1db00a (diff)
- Remove lock in destructor.
- Use AddRef/SubRef to make target safe.
Diffstat (limited to 'config')
-rw-r--r--config/src/vespa/config/frt/frtconnection.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/config/src/vespa/config/frt/frtconnection.cpp b/config/src/vespa/config/frt/frtconnection.cpp
index 466239200d4..be8ccead65c 100644
--- a/config/src/vespa/config/frt/frtconnection.cpp
+++ b/config/src/vespa/config/frt/frtconnection.cpp
@@ -28,7 +28,6 @@ FRTConnection::FRTConnection(const vespalib::string& address, FRT_Supervisor& su
FRTConnection::~FRTConnection()
{
- std::lock_guard guard(_lock);
if (_target != nullptr) {
LOG(debug, "Shutting down %s", _address.c_str());
_target->SubRef();
@@ -46,13 +45,16 @@ FRTConnection::getTarget()
_target->SubRef();
_target = _supervisor.GetTarget(_address.c_str());
}
+ _target->AddRef();
return _target;
}
void
FRTConnection::invoke(FRT_RPCRequest * req, duration timeout, FRT_IRequestWait * waiter)
{
- getTarget()->InvokeAsync(req, vespalib::to_s(timeout), waiter);
+ FRT_Target * target = getTarget();
+ target->InvokeAsync(req, vespalib::to_s(timeout), waiter);
+ target->SubRef();
}
void