aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/remote_client_connection.h
blob: 124a37a07a5b38dac8cdfbaf921b9ee5c293b694 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once 
 
#include "connection.h"
#include "local_tasks.h" 
#include "remote_client_session.h"
#include "remote_connection.h" 
 
#include <util/generic/object_counter.h>

namespace NBus {
    namespace NPrivate {
        class TRemoteClientConnection: public TRemoteConnection, public TBusClientConnection {
            friend class TRemoteConnection;
            friend struct TBusSessionImpl;
            friend class TRemoteClientSession;
 
        private:
            TObjectCounter<TRemoteClientConnection> ObjectCounter;
 
            TSyncAckMessages AckMessages;
 
            TLocalTasks TimeToTimeoutMessages;
 
            IBusClientHandler* const ClientHandler;
 
        public:
            TRemoteClientConnection(TRemoteClientSessionPtr session, ui64 id, TNetAddr addr);
 
            inline TRemoteClientSession* GetSession();
 
            SOCKET CreateSocket(const TNetAddr& addr);
 
            void TryConnect() override;
 
            void HandleEvent(SOCKET socket, void* cookie) override;
 
            TBusMessage* PopAck(TBusKey id);
 
            void WriterFillStatus() override;
 
            void ClearOutgoingQueue(TMessagesPtrs& result, bool reconnect) override;
 
            void BeforeTryWrite() override;
 
            void ProcessReplyQueue();
 
            void MessageSent(TArrayRef<TBusMessagePtrAndHeader> messages) override;
 
            void TimeoutMessages();
 
            void ScheduleTimeoutMessages();
 
            void ReaderProcessMessageUnknownVersion(TArrayRef<const char> dataRef) override;
 
            EMessageStatus SendMessage(TBusMessage* pMes, bool wait) override;
 
            EMessageStatus SendMessageOneWay(TBusMessage* pMes, bool wait) override;
 
            EMessageStatus SendMessageImpl(TBusMessage*, bool wait, bool oneWay);
 
            void OpenConnection() override;
        };
 
    }
}