diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/messagebus/remote_server_session.cpp | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/remote_server_session.cpp')
-rw-r--r-- | library/cpp/messagebus/remote_server_session.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/library/cpp/messagebus/remote_server_session.cpp b/library/cpp/messagebus/remote_server_session.cpp index 0bc2853e94..6abbf88a60 100644 --- a/library/cpp/messagebus/remote_server_session.cpp +++ b/library/cpp/messagebus/remote_server_session.cpp @@ -16,47 +16,47 @@ using namespace NBus; using namespace NBus::NPrivate; TRemoteServerSession::TRemoteServerSession(TBusMessageQueue* queue, - TBusProtocol* proto, IBusServerHandler* handler, - const TBusServerSessionConfig& config, const TString& name) + TBusProtocol* proto, IBusServerHandler* handler, + const TBusServerSessionConfig& config, const TString& name) : TBusSessionImpl(false, queue, proto, handler, config, name) , ServerOwnedMessages(config.MaxInFlight, config.MaxInFlightBySize, "ServerOwnedMessages") , ServerHandler(handler) { - if (config.PerConnectionMaxInFlightBySize > 0) { - if (config.PerConnectionMaxInFlightBySize < config.MaxMessageSize) + if (config.PerConnectionMaxInFlightBySize > 0) { + if (config.PerConnectionMaxInFlightBySize < config.MaxMessageSize) ythrow yexception() << "too low PerConnectionMaxInFlightBySize value"; } } -namespace NBus { - namespace NPrivate { - class TInvokeOnMessage: public IWorkItem { - private: - TRemoteServerSession* RemoteServerSession; - TBusMessagePtrAndHeader Request; - TIntrusivePtr<TRemoteServerConnection> Connection; +namespace NBus { + namespace NPrivate { + class TInvokeOnMessage: public IWorkItem { + private: + TRemoteServerSession* RemoteServerSession; + TBusMessagePtrAndHeader Request; + TIntrusivePtr<TRemoteServerConnection> Connection; + + public: + TInvokeOnMessage(TRemoteServerSession* session, TBusMessagePtrAndHeader& request, TIntrusivePtr<TRemoteServerConnection>& connection) + : RemoteServerSession(session) + { + Y_ASSERT(!!connection); + Connection.Swap(connection); + + Request.Swap(request); + } + + void DoWork() override { + THolder<TInvokeOnMessage> holder(this); + RemoteServerSession->InvokeOnMessage(Request, Connection); + // TODO: TRemoteServerSessionSemaphore should be enough + RemoteServerSession->JobCount.Decrement(); + } + }; - public: - TInvokeOnMessage(TRemoteServerSession* session, TBusMessagePtrAndHeader& request, TIntrusivePtr<TRemoteServerConnection>& connection) - : RemoteServerSession(session) - { - Y_ASSERT(!!connection); - Connection.Swap(connection); - - Request.Swap(request); - } - - void DoWork() override { - THolder<TInvokeOnMessage> holder(this); - RemoteServerSession->InvokeOnMessage(Request, Connection); - // TODO: TRemoteServerSessionSemaphore should be enough - RemoteServerSession->JobCount.Decrement(); - } - }; - - } -} + } +} void TRemoteServerSession::OnMessageReceived(TRemoteConnection* c, TVectorSwaps<TBusMessagePtrAndHeader>& messages) { AcquireInWorkRequests(messages); @@ -165,7 +165,7 @@ void TRemoteServerSession::ReleaseInWorkResponses(TArrayRef<const TBusMessagePtr ServerOwnedMessages.ReleaseMultiple(responses.size(), size); } -void TRemoteServerSession::ReleaseInWorkRequests(TRemoteConnection& con, TBusMessage* request) { +void TRemoteServerSession::ReleaseInWorkRequests(TRemoteConnection& con, TBusMessage* request) { Y_ASSERT((request->LocalFlags & MESSAGE_IN_WORK)); request->LocalFlags &= ~MESSAGE_IN_WORK; @@ -175,7 +175,7 @@ void TRemoteServerSession::ReleaseInWorkRequests(TRemoteConnection& con, TBusMes ServerOwnedMessages.ReleaseMultiple(1, size); } -void TRemoteServerSession::ReleaseInWork(TBusIdentity& ident) { +void TRemoteServerSession::ReleaseInWork(TBusIdentity& ident) { ident.SetInWork(false); ident.Connection->QuotaReturnAside(1, ident.Size); |