remote_server_session.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include "remote_server_session_semaphore.h"
  3. #include "session_impl.h"
  4. #ifdef _MSC_VER
  5. #pragma warning(push)
  6. #pragma warning(disable : 4250) // 'NBus::NPrivate::TRemoteClientSession' : inherits 'NBus::NPrivate::TBusSessionImpl::NBus::NPrivate::TBusSessionImpl::GetConfig' via dominance
  7. #endif
  8. namespace NBus {
  9. namespace NPrivate {
  10. class TRemoteServerSession: public TBusServerSession, public TBusSessionImpl {
  11. friend class TRemoteServerConnection;
  12. private:
  13. TObjectCounter<TRemoteServerSession> ObjectCounter;
  14. TRemoteServerSessionSemaphore ServerOwnedMessages;
  15. IBusServerHandler* const ServerHandler;
  16. public:
  17. TRemoteServerSession(TBusMessageQueue* queue, TBusProtocol* proto,
  18. IBusServerHandler* handler,
  19. const TBusSessionConfig& config, const TString& name);
  20. void OnMessageReceived(TRemoteConnection* c, TVectorSwaps<TBusMessagePtrAndHeader>& newMsg) override;
  21. void InvokeOnMessage(TBusMessagePtrAndHeader& request, TIntrusivePtr<TRemoteServerConnection>& conn);
  22. EMessageStatus SendReply(const TBusIdentity& ident, TBusMessage* pRep) override;
  23. EMessageStatus ForgetRequest(const TBusIdentity& ident) override;
  24. int GetInFlight() const noexcept override;
  25. void FillStatus() override;
  26. void Shutdown() override;
  27. void PauseInput(bool pause) override;
  28. unsigned GetActualListenPort() override;
  29. void AcquireInWorkRequests(TArrayRef<const TBusMessagePtrAndHeader> requests);
  30. void ReleaseInWorkResponses(TArrayRef<const TBusMessagePtrAndHeader> responses);
  31. void ReleaseInWorkRequests(TRemoteConnection&, TBusMessage*);
  32. void ReleaseInWork(TBusIdentity&);
  33. void ConvertInWork(TBusIdentity& req, TBusMessage* reply);
  34. };
  35. #ifdef _MSC_VER
  36. #pragma warning(pop)
  37. #endif
  38. }
  39. }