blob: 602381839efb836db169cef38450efd30ee9b84a (
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
|
#pragma once
#include "acceptor_status.h"
#include "defs.h"
#include "event_loop.h"
#include "netaddr.h"
#include "session_impl.h"
#include "shutdown_state.h"
#include <library/cpp/messagebus/actor/actor.h>
#include <util/system/event.h>
namespace NBus {
namespace NPrivate {
class TAcceptor
: public NEventLoop::IEventHandler,
private ::NActor::TActor<TAcceptor> {
friend struct TBusSessionImpl;
friend class ::NActor::TActor<TAcceptor>;
public:
TAcceptor(TBusSessionImpl* session, ui64 acceptorId, SOCKET socket, const TNetAddr& addr);
void HandleEvent(SOCKET socket, void* cookie) override;
void Shutdown();
inline ::NActor::TActor<TAcceptor>* GetActor() {
return this;
}
private:
void SendStatus(TInstant now);
void Act(::NActor::TDefaultTag);
private:
const ui64 AcceptorId;
TBusSessionImpl* const Session;
NEventLoop::TChannelPtr Channel;
TAcceptorStatus Stats;
TAtomicShutdownState ShutdownState;
struct TGranStatus {
TGranStatus(TDuration gran)
: Listen(gran)
{
}
TGranUp<TAcceptorStatus> Listen;
};
TGranStatus GranStatus;
};
}
}
|