13 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
17 processPendingEvents();
20 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
23 processPendingEvents();
26 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
30 processPendingEvents();
33 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
35 pendingEvents_.push_back(
AppClose());
36 processPendingEvents();
39 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
44 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
47 processPendingEvents();
50 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
56 while (!pendingEvents_.empty()) {
57 auto event =
std::move(pendingEvents_.front());
58 pendingEvents_.pop_front();
63 write.callback->writeErr(0, ex);
75 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
77 return inErrorState_ || state_.state() == decltype(state_.state())::Error;
80 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
83 return actionGuard_.hasValue();
86 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
88 typename StateMachine::CompletedActions
actions) {
93 for (
auto&
action : actions) {
98 processPendingEvents();
101 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
103 typename StateMachine::ProcessingActions
actions) {
105 throw std::runtime_error(
"actions already processing");
110 static_cast<Derived*
>(
this)->startActions(
std::move(actions));
113 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
116 if (inProcessPendingEvents_) {
121 inProcessPendingEvents_ =
true;
123 inProcessPendingEvents_ =
false;
126 while (!actionGuard_ && !inErrorState()) {
130 actions = machine_.processSocketData(state_, transportReadBuf_);
131 }
else if (!pendingEvents_.empty()) {
132 auto event =
std::move(pendingEvents_.front());
133 pendingEvents_.pop_front();
138 machine_.processWriteNewSessionTicket(state_,
std::move(write));
141 actions = machine_.processAppWrite(state_,
std::move(write));
144 actions = machine_.processEarlyAppWrite(state_,
std::move(write));
147 actions = machine_.processAppClose(state_);
150 actionGuard_.clear();
154 static_cast<Derived*
>(
this)->startActions(
std::move(*actions));
158 template <
typename Derived,
typename ActionMoveVisitor,
typename StateMachine>
165 (*state_.exporterMasterSecret())->coalesce(),
167 context ? context->clone() :
nullptr,
void write(const T &in, folly::io::Appender &appender)
void processActions(typename StateMachine::CompletedActions actions)
void moveToErrorState(const folly::AsyncSocketException &ex)
constexpr detail::Map< Move > move
void earlyAppWrite(EarlyAppWrite appWrite)
Buf getEkm(folly::StringPiece label, const Buf &context, uint16_t length) const
void processPendingEvents()
bool inErrorState() const
Actions actions(Args &&...act)
void addProcessingActions(typename StateMachine::ProcessingActions actions)
static Buf getEkm(CipherSuite cipher, folly::ByteRange exporterMaster, folly::StringPiece label, Buf context, uint16_t length)
decltype(auto) apply_visitor(Visitor &&visitor, const DiscriminatedPtr< Args... > &variant)
std::unique_ptr< folly::IOBuf > Buf
decltype(auto) variant_match(Variant &&variant, Cases &&...cases)
void appWrite(AppWrite appWrite)
virtual void writeErr(size_t bytesWritten, const AsyncSocketException &ex) noexcept=0
void writeNewSessionTicket(WriteNewSessionTicket writeNewSessionTicket)
bool actionProcessing() const
folly::AsyncTransportWrapper::WriteCallback * callback