proxygen
proxygen::CodecErrorResponseHandler Class Reference

#include <CodecErrorResponseHandler.h>

Inheritance diagram for proxygen::CodecErrorResponseHandler:
proxygen::HTTPTransactionHandler

Public Member Functions

 CodecErrorResponseHandler (ErrorCode statusCode)
 
void setTransaction (HTTPTransaction *txn) noexceptoverride
 
void detachTransaction () noexceptoverride
 
void onHeadersComplete (std::unique_ptr< HTTPMessage > msg) noexceptoverride
 
void onBody (std::unique_ptr< folly::IOBuf > chain) noexceptoverride
 
void onTrailers (std::unique_ptr< HTTPHeaders > trailers) noexceptoverride
 
void onEOM () noexceptoverride
 
void onUpgrade (UpgradeProtocol protocol) noexceptoverride
 
void onError (const HTTPException &error) noexceptoverride
 
void onEgressPaused () noexceptoverride
 
void onEgressResumed () noexceptoverride
 
- Public Member Functions inherited from proxygen::HTTPTransactionHandler
virtual void onChunkHeader (size_t) noexcept
 
virtual void onChunkComplete () noexcept
 
virtual void onPushedTransaction (HTTPTransaction *) noexcept
 
virtual void onExTransaction (HTTPTransaction *) noexcept
 
virtual void onGoaway (ErrorCode) noexcept
 
virtual ~HTTPTransactionHandler ()
 

Private Member Functions

 ~CodecErrorResponseHandler () override
 

Private Attributes

HTTPTransactiontxn_
 

Detailed Description

Definition at line 18 of file CodecErrorResponseHandler.h.

Constructor & Destructor Documentation

proxygen::CodecErrorResponseHandler::CodecErrorResponseHandler ( ErrorCode  statusCode)
explicit

Definition at line 20 of file CodecErrorResponseHandler.cpp.

21  : txn_(nullptr) {}
proxygen::CodecErrorResponseHandler::~CodecErrorResponseHandler ( )
overrideprivate

Definition at line 23 of file CodecErrorResponseHandler.cpp.

Referenced by onEgressResumed().

23  {
24 }

Member Function Documentation

void proxygen::CodecErrorResponseHandler::detachTransaction ( )
overridevirtualnoexcept

Called once after a transaction successfully completes. It will be called even if a read or write error happened earlier. This is a terminal callback, which means that the HTTPTransaction object that gives this call will be invalid after this function completes.

Implements proxygen::HTTPTransactionHandler.

Definition at line 32 of file CodecErrorResponseHandler.cpp.

32  {
33  delete this;
34 }
void proxygen::CodecErrorResponseHandler::onBody ( std::unique_ptr< folly::IOBuf chain)
overridevirtualnoexcept

Can be called multiple times per transaction. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress().

Implements proxygen::HTTPTransactionHandler.

Definition at line 41 of file CodecErrorResponseHandler.cpp.

41  {
42  VLOG(4) << "discarding request body";
43 }
void proxygen::CodecErrorResponseHandler::onEgressPaused ( )
inlineoverridevirtualnoexcept

If the remote side's receive buffer fills up, this callback will be invoked so you can attempt to stop sending to the remote side.

Implements proxygen::HTTPTransactionHandler.

Definition at line 33 of file CodecErrorResponseHandler.h.

33 {};
void proxygen::CodecErrorResponseHandler::onEgressResumed ( )
inlineoverridevirtualnoexcept

This callback lets you know that the remote side has resumed reading and you can now continue to send data.

Implements proxygen::HTTPTransactionHandler.

Definition at line 34 of file CodecErrorResponseHandler.h.

References ~CodecErrorResponseHandler().

34 {};
void proxygen::CodecErrorResponseHandler::onEOM ( )
overridevirtualnoexcept

Can be called once per transaction. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress(). After this callback is received, there will be no more normal ingress callbacks received (onEgress*() and onError() may still be invoked). The Handler should consider ingress complete after receiving this message. This Transaction is still valid, and work may still occur on it until detachTransaction is called.

Implements proxygen::HTTPTransactionHandler.

Definition at line 51 of file CodecErrorResponseHandler.cpp.

51  {
52 }
void proxygen::CodecErrorResponseHandler::onError ( const HTTPException error)
overridevirtualnoexcept

Can be called at any time before detachTransaction(). This callback implies that an error has occurred. To determine if ingress or egress is affected, check the direciont on the HTTPException. If the direction is INGRESS, it MAY still be possible to send egress.

Implements proxygen::HTTPTransactionHandler.

Definition at line 57 of file CodecErrorResponseHandler.cpp.

References folly::pushmi::operators::error(), proxygen::HTTPTransaction::sendAbort(), and txn_.

57  {
58  VLOG(4) << "processing error " << error;
59  txn_->sendAbort();
60 }
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
void proxygen::CodecErrorResponseHandler::onHeadersComplete ( std::unique_ptr< HTTPMessage msg)
overridevirtualnoexcept

Called at most once per transaction. This is usually the first ingress callback. It is possible to get a read error before this however. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress().

Implements proxygen::HTTPTransactionHandler.

Definition at line 36 of file CodecErrorResponseHandler.cpp.

37  {
38  VLOG(4) << "discarding headers";
39 }
void proxygen::CodecErrorResponseHandler::onTrailers ( std::unique_ptr< HTTPHeaders trailers)
overridevirtualnoexcept

Can be called any number of times per transaction. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress(). Trailers can be received once right before the EOM of a chunked HTTP/1.1 reponse or multiple times per transaction from SPDY and HTTP/2.0 HEADERS frames.

Implements proxygen::HTTPTransactionHandler.

Definition at line 45 of file CodecErrorResponseHandler.cpp.

46  {
47  VLOG(4) << "discarding request trailers";
48 }
void proxygen::CodecErrorResponseHandler::onUpgrade ( UpgradeProtocol  protocol)
overridevirtualnoexcept

Can be called once per transaction. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress(). After this callback is invoked, further data will be forwarded using the onBody() callback. Once the data transfer is completed (EOF recevied in case of CONNECT), onEOM() callback will be invoked.

Implements proxygen::HTTPTransactionHandler.

Definition at line 54 of file CodecErrorResponseHandler.cpp.

55  {}
void proxygen::CodecErrorResponseHandler::setTransaction ( HTTPTransaction txn)
overridevirtualnoexcept

Called once per transaction. This notifies the handler of which transaction it should talk to and will receive callbacks from.

Implements proxygen::HTTPTransactionHandler.

Definition at line 27 of file CodecErrorResponseHandler.cpp.

References txn_.

27  {
28  txn_ = txn;
29 }

Member Data Documentation

HTTPTransaction* proxygen::CodecErrorResponseHandler::txn_
private

Definition at line 39 of file CodecErrorResponseHandler.h.

Referenced by onError(), and setTransaction().


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