proxygen
fizz::server::ServerStateMachine Class Reference

#include <ServerProtocol.h>

Inheritance diagram for fizz::server::ServerStateMachine:
fizz::server::test::MockServerStateMachine fizz::server::test::MockServerStateMachineInstance fizz::server::test::MockServerStateMachineInstance

Public Types

using StateType = State
 
using ProcessingActions = AsyncActions
 
using CompletedActions = Actions
 

Public Member Functions

virtual ~ServerStateMachine ()=default
 
virtual AsyncActions processAccept (const State &, folly::Executor *executor, std::shared_ptr< const FizzServerContext > context, const std::shared_ptr< ServerExtensions > &extensions)
 
virtual AsyncActions processSocketData (const State &, folly::IOBufQueue &)
 
virtual AsyncActions processWriteNewSessionTicket (const State &, WriteNewSessionTicket)
 
virtual AsyncActions processAppWrite (const State &, AppWrite)
 
virtual AsyncActions processEarlyAppWrite (const State &, EarlyAppWrite)
 
virtual Actions processAppClose (const State &)
 

Detailed Description

Definition at line 25 of file ServerProtocol.h.

Member Typedef Documentation

Constructor & Destructor Documentation

virtual fizz::server::ServerStateMachine::~ServerStateMachine ( )
virtualdefault

Member Function Documentation

AsyncActions fizz::server::ServerStateMachine::processAccept ( const State state,
folly::Executor executor,
std::shared_ptr< const FizzServerContext context,
const std::shared_ptr< ServerExtensions > &  extensions 
)
virtual

Reimplemented in fizz::server::test::MockServerStateMachine.

Definition at line 121 of file ServerProtocol.cpp.

References folly::netops::accept(), fizz::Accept::context, fizz::Accept::executor, folly::pushmi::executor, fizz::Accept::extensions, folly::gen::move, and fizz::server::detail::processEvent().

125  {
126  Accept accept;
127  accept.executor = executor;
128  accept.context = std::move(context);
129  accept.extensions = extensions;
130  return detail::processEvent(state, std::move(accept));
131 }
context
Definition: CMakeCache.txt:563
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
PUSHMI_INLINE_VAR constexpr __adl::get_executor_fn executor
AsyncActions processEvent(const State &state, Param param)
NetworkSocket accept(NetworkSocket s, sockaddr *addr, socklen_t *addrlen)
Definition: NetOps.cpp:71
Actions fizz::server::ServerStateMachine::processAppClose ( const State state)
virtual

Reimplemented in fizz::server::test::MockServerStateMachine.

Definition at line 174 of file ServerProtocol.cpp.

References fizz::server::detail::handleAppClose().

Referenced by fizz::server::test::TEST_F().

174  {
175  return detail::handleAppClose(state);
176 }
Actions handleAppClose(const State &state)
AsyncActions fizz::server::ServerStateMachine::processAppWrite ( const State state,
AppWrite  write 
)
virtual

Reimplemented in fizz::server::test::MockServerStateMachine.

Definition at line 162 of file ServerProtocol.cpp.

References folly::gen::move, and fizz::server::detail::processEvent().

164  {
165  return detail::processEvent(state, std::move(write));
166 }
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
AsyncActions processEvent(const State &state, Param param)
AsyncActions fizz::server::ServerStateMachine::processEarlyAppWrite ( const State state,
EarlyAppWrite  write 
)
virtual

Reimplemented in fizz::server::test::MockServerStateMachine.

Definition at line 168 of file ServerProtocol.cpp.

References folly::gen::move, and fizz::server::detail::processEvent().

170  {
171  return detail::processEvent(state, std::move(write));
172 }
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
AsyncActions processEvent(const State &state, Param param)
AsyncActions fizz::server::ServerStateMachine::processSocketData ( const State state,
folly::IOBufQueue buf 
)
virtual

Reimplemented in fizz::server::test::MockServerStateMachine.

Definition at line 133 of file ServerProtocol.cpp.

References fizz::server::detail::actions(), fizz::decode_error, fizz::server::detail::handleError(), folly::gen::move, folly::none, fizz::server::detail::processEvent(), fizz::ReadRecordLayer::readEvent(), and fizz::server::State::readRecordLayer().

135  {
136  try {
137  if (!state.readRecordLayer()) {
138  return detail::handleError(
139  state,
140  ReportError("attempting to process data without record layer"),
141  folly::none);
142  }
143  auto param = state.readRecordLayer()->readEvent(buf);
144  if (!param.hasValue()) {
145  return actions(WaitForData());
146  }
147  return detail::processEvent(state, std::move(*param));
148  } catch (const std::exception& e) {
149  return detail::handleError(
150  state,
151  ReportError(folly::exception_wrapper(std::current_exception(), e)),
153  }
154 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
ReadRecordLayer * readRecordLayer() const
Definition: State.h:213
virtual folly::Optional< Param > readEvent(folly::IOBufQueue &socketBuf)
Definition: RecordLayer.cpp:18
Actions handleError(const State &state, ReportError error, Optional< AlertDescription > alertDesc)
Actions actions(Args &&...act)
Definition: Actions.h:86
AsyncActions processEvent(const State &state, Param param)
constexpr None none
Definition: Optional.h:87
AsyncActions fizz::server::ServerStateMachine::processWriteNewSessionTicket ( const State state,
WriteNewSessionTicket  write 
)
virtual

Reimplemented in fizz::server::test::MockServerStateMachine.

Definition at line 156 of file ServerProtocol.cpp.

References folly::gen::move, and fizz::server::detail::processEvent().

158  {
159  return detail::processEvent(state, std::move(write));
160 }
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
AsyncActions processEvent(const State &state, Param param)

The documentation for this class was generated from the following files: