From d097b73853e8e8dbaaf91d7c7fcca94c06d69f27 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 21 Dec 2022 15:32:51 +0000 Subject: Use the builtin sync capability of the transport object. --- .../src/vespa/messagebus/network/rpcnetwork.cpp | 35 ++-------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'messagebus') 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 #include #include -#include #include #include @@ -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 -- cgit v1.2.3