proxygen
fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor Class Reference
Inheritance diagram for fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor:

Public Member Functions

 ActionMoveVisitor (AsyncFizzClientT< SM > &client)
 
void operator() (DeliverAppData &)
 
void operator() (WriteToSocket &)
 
void operator() (ReportEarlyHandshakeSuccess &)
 
void operator() (ReportHandshakeSuccess &)
 
void operator() (ReportEarlyWriteFailed &)
 
void operator() (ReportError &)
 
void operator() (WaitForData &)
 
void operator() (MutateState &)
 
void operator() (NewCachedPsk &)
 

Private Attributes

AsyncFizzClientT< SM > & client_
 

Detailed Description

template<typename SM>
class fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor

Definition at line 164 of file AsyncFizzClient.h.

Constructor & Destructor Documentation

template<typename SM>
fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::ActionMoveVisitor ( AsyncFizzClientT< SM > &  client)
inlineexplicit

Definition at line 166 of file AsyncFizzClient.h.

167  : client_(client) {}

Member Function Documentation

template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( DeliverAppData data)

Definition at line 396 of file AsyncFizzClient-inl.h.

References fizz::DeliverAppData::data, and folly::gen::move.

396  {
397  client_.deliverAppData(std::move(data.data));
398 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( WriteToSocket data)

Definition at line 401 of file AsyncFizzClient-inl.h.

References fizz::WriteToSocket::callback, fizz::WriteToSocket::contents, fizz::WriteToSocket::flags, i, and folly::gen::move.

401  {
402  DCHECK(!data.contents.empty());
403  Buf allData = std::move(data.contents.front().data);
404  for (size_t i = 1; i < data.contents.size(); ++i) {
405  allData->prependChain(std::move(data.contents[i].data));
406  }
407  client_.transport_->writeChain(data.callback, std::move(allData), data.flags);
408 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< folly::IOBuf > Buf
Definition: Types.h:22
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( ReportEarlyHandshakeSuccess earlySuccess)

Definition at line 411 of file AsyncFizzClient-inl.h.

References fizz::client::AsyncFizzClientT< SM >::HandshakeCallback::fizzHandshakeSuccess(), fizz::client::ReportEarlyHandshakeSuccess::maxEarlyDataSize, folly::none, and folly::variant_match().

412  {
413  client_.earlyDataState_ = EarlyDataState();
414  client_.earlyDataState_->remainingEarlyData = earlySuccess.maxEarlyDataSize;
415  if (client_.callback_) {
416  auto cb = *client_.callback_;
417  client_.callback_ = folly::none;
419  cb,
420  [this](HandshakeCallback* callback) {
421  callback->fizzHandshakeSuccess(&client_);
422  },
424  callback->connectSuccess();
425  });
426  }
427 }
decltype(auto) variant_match(Variant &&variant, Cases &&...cases)
Definition: Overload.h:74
constexpr None none
Definition: Optional.h:87
template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( ReportHandshakeSuccess success)

Definition at line 457 of file AsyncFizzClient-inl.h.

References fizz::client::ReportHandshakeSuccess::earlyDataAccepted, fizz::client::AsyncFizzClientT< SM >::HandshakeCallback::fizzHandshakeSuccess(), folly::gen::move, folly::none, and folly::variant_match().

458  {
459  client_.cancelHandshakeTimeout();
460  if (client_.earlyDataState_) {
461  if (!success.earlyDataAccepted) {
462  auto ex = client_.handleEarlyReject();
463  if (ex) {
464  if (client_.pskIdentity_) {
465  client_.fizzContext_->removePsk(*client_.pskIdentity_);
466  }
467  client_.deliverAllErrors(*ex, false);
468  client_.transport_->closeNow();
469  return;
470  }
471  }
472 
473  while (!client_.earlyDataState_->pendingAppWrites.empty()) {
474  auto w = std::move(client_.earlyDataState_->pendingAppWrites.front());
475  client_.earlyDataState_->pendingAppWrites.pop_front();
476  client_.fizzClient_.appWrite(std::move(w));
477  }
478  client_.earlyDataState_.clear();
479  }
480  if (client_.callback_) {
481  auto cb = *client_.callback_;
482  client_.callback_ = folly::none;
484  cb,
485  [this](HandshakeCallback* callback) {
486  callback->fizzHandshakeSuccess(&client_);
487  },
489  callback->connectSuccess();
490  });
491  }
492  if (client_.replaySafetyCallback_) {
493  auto callback = client_.replaySafetyCallback_;
494  client_.replaySafetyCallback_ = nullptr;
495  callback->onReplaySafe();
496  }
497 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
decltype(auto) variant_match(Variant &&variant, Cases &&...cases)
Definition: Overload.h:74
constexpr None none
Definition: Optional.h:87
template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( ReportEarlyWriteFailed write)

Definition at line 500 of file AsyncFizzClient-inl.h.

References fizz::EarlyAppWrite::callback, fizz::client::ReportEarlyWriteFailed::write, and folly::AsyncWriter::WriteCallback::writeSuccess().

501  {
502  // If the state machine reports that an early write happened after early data
503  // was already rejected, we need to invoke some write callback so that the
504  // write isn't leaked. For now we just call writeSuccess and let the actual
505  // rejection or early data get sorted out after full handshake success.
506  //
507  // TODO: buffer these callbacks until full handshake success, and call
508  // writeSuccess/writeErr depending on whether we are treating rejection
509  // as a fatal error.
510  if (write.write.callback) {
511  write.write.callback->writeSuccess();
512  }
513 }
void write(folly::AsyncTransportWrapper::WriteCallback *callback, const void *buf, size_t bytes, folly::WriteFlags flags=folly::WriteFlags::NONE) override
template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( ReportError error)
template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( WaitForData )

Definition at line 524 of file AsyncFizzClient-inl.h.

524  {
525  client_.fizzClient_.waitForData();
526 
527  if (client_.callback_) {
528  // Make sure that the read callback is installed.
529  client_.startTransportReads();
530  }
531 }
template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( MutateState mutator)

Definition at line 534 of file AsyncFizzClient-inl.h.

534  {
535  mutator(client_.state_);
536 }
template<typename SM >
void fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::operator() ( NewCachedPsk newCachedPsk)

Definition at line 539 of file AsyncFizzClient-inl.h.

References folly::gen::move, and fizz::client::NewCachedPsk::psk.

540  {
541  if (client_.pskIdentity_) {
542  client_.fizzContext_->putPsk(
543  *client_.pskIdentity_, std::move(newCachedPsk.psk));
544  }
545 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Data Documentation

template<typename SM>
AsyncFizzClientT<SM>& fizz::client::AsyncFizzClientT< SM >::ActionMoveVisitor::client_
private

Definition at line 180 of file AsyncFizzClient.h.


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