diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-12-21 15:32:51 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-12-21 15:32:51 +0000 |
commit | d097b73853e8e8dbaaf91d7c7fcca94c06d69f27 (patch) | |
tree | 62f903d90baf32e43c942330c31307f2cc5de23c | |
parent | a3d5e2ce14352ab181e940574f6e1a99d40cd520 (diff) |
Use the builtin sync capability of the transport object.
-rw-r--r-- | messagebus/src/vespa/messagebus/network/rpcnetwork.cpp | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp index bc3ba205b69..030e3f956e1 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp @@ -18,7 +18,6 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/stringfmt.h> -#include <vespa/vespalib/util/gate.h> #include <vespa/fastos/thread.h> #include <thread> @@ -32,36 +31,6 @@ namespace mbus { namespace { -/** - * Implements a helper class for {@link RPCNetwork#sync()}. It provides a - * blocking method {@link #await()} that will wait until the internal state - * of this object is set to 'done'. By scheduling this task in the network - * thread and then calling this method, we achieve handshaking with the network - * thread. - */ -class SyncTask : public FNET_Task { -private: - vespalib::Gate _gate; - -public: - SyncTask(FNET_Scheduler &s) : - FNET_Task(&s), - _gate() { - ScheduleNow(); - } - ~SyncTask() override { - Kill(); - } - - void await() { - _gate.await(); - } - - void PerformTask() override { - _gate.countDown(); - } -}; - struct TargetPoolTask : public FNET_Task { RPCTargetPool &_pool; @@ -412,8 +381,8 @@ RPCNetwork::send(RPCNetwork::SendContext &ctx) void RPCNetwork::sync() { - SyncTask task(_scheduler); - task.await(); + _transport->sync(); // Ensure transport loop run at least once to execute task scheduled for NOW + _transport->sync(); // And then once more to ensure they are all done. } void |