|
xrpld
|
Represents an active connection. More...
#include <BaseHTTPPeer.h>


Classes | |
| struct | Buffer |
Public Member Functions | |
| template<class ConstBufferSequence> | |
| BaseHTTPPeer (Port const &port, Handler &handler, boost::asio::executor const &executor, beast::Journal journal, endpoint_type remoteAddress, ConstBufferSequence const &buffers) | |
| ~BaseHTTPPeer () override | |
| Session & | session () |
| void | close () override |
| IOList & | ios () |
| Return the IOList associated with the work. | |
| virtual std::shared_ptr< WSSession > | websocketUpgrade ()=0 |
| Convert the connection to WebSocket. | |
| void | write (std::string_view s) |
| Send a copy of data asynchronously. | |
| template<typename BufferSequence> | |
| void | write (BufferSequence const &buffers) |
Public Attributes | |
| void * | tag = nullptr |
| A user-definable pointer. | |
Protected Types | |
| using | clock_type = std::chrono::system_clock |
| using | error_code = boost::system::error_code |
| using | endpoint_type = boost::asio::ip::tcp::endpoint |
| using | yield_context = boost::asio::yield_context |
Protected Member Functions | |
| Impl & | impl () |
| void | fail (error_code ec, char const *what) |
| void | startTimer () |
| void | cancelTimer () |
| void | onTimer () |
| void | doRead (yield_context doYield) |
| void | onWrite (error_code const &ec, std::size_t bytesTransferred) |
| void | doWriter (std::shared_ptr< Writer > const &writer, bool keepAlive, yield_context doYield) |
| virtual void | doRequest ()=0 |
| virtual void | doClose ()=0 |
| beast::Journal | journal () override |
| Returns the Journal to use for logging. | |
| Port const & | port () override |
| Returns the Port settings for this connection. | |
| beast::IP::Endpoint | remoteAddress () override |
| Returns the remote address of the connection. | |
| http_request_type & | request () override |
| Returns the current HTTP request. | |
| void | write (void const *buffer, std::size_t bytes) override |
| void | write (std::shared_ptr< Writer > const &writer, bool keepAlive) override |
| std::shared_ptr< Session > | detach () override |
| Detach the session. | |
| void | complete () override |
| Indicate that the response is complete. | |
| void | close (bool graceful) override |
| Close the session. | |
Protected Attributes | |
| Port const & | port_ |
| Handler & | handler_ |
| boost::asio::executor_work_guard< boost::asio::executor > | work_ |
| boost::asio::strand< boost::asio::executor > | strand_ |
| endpoint_type | remoteAddress_ |
| beast::Journal const | journal_ |
| std::string | id_ |
| std::size_t | nid_ |
| boost::asio::streambuf | readBuf_ |
| http_request_type | message_ |
| std::vector< Buffer > | wq_ |
| std::vector< Buffer > | wq2_ |
| std::mutex | mutex_ |
| bool | graceful_ = false |
| bool | complete_ = false |
| boost::system::error_code | ec_ |
| int | requestCount_ = 0 |
| std::size_t | bytesIn_ = 0 |
| std::size_t | bytesOut_ = 0 |
Static Protected Attributes | |
| static constexpr auto | kBufferSize = 4 * 1024 |
| static constexpr auto | kTimeoutSeconds = 30 |
| static constexpr auto | kTimeoutSecondsLocal = 3 |
Private Member Functions | |
| template<class = void> | |
| void | destroy () |
Private Attributes | |
| IOList * | ios_ = nullptr |
Represents an active connection.
Definition at line 33 of file BaseHTTPPeer.h.
|
protected |
Definition at line 36 of file BaseHTTPPeer.h.
|
protected |
Definition at line 37 of file BaseHTTPPeer.h.
|
protected |
Definition at line 38 of file BaseHTTPPeer.h.
|
protected |
Definition at line 39 of file BaseHTTPPeer.h.
| xrpl::BaseHTTPPeer< Handler, Impl >::BaseHTTPPeer | ( | Port const & | port, |
| Handler & | handler, | ||
| boost::asio::executor const & | executor, | ||
| beast::Journal | journal, | ||
| endpoint_type | remoteAddress, | ||
| ConstBufferSequence const & | buffers ) |
Definition at line 183 of file BaseHTTPPeer.h.
|
override |
Definition at line 206 of file BaseHTTPPeer.h.
| Session & xrpl::BaseHTTPPeer< Handler, Impl >::session | ( | ) |
Definition at line 95 of file BaseHTTPPeer.h.
|
overridevirtual |
Implements xrpl::IOList::Work.
Definition at line 215 of file BaseHTTPPeer.h.
|
protected |
Definition at line 105 of file BaseHTTPPeer.h.
|
protected |
Definition at line 231 of file BaseHTTPPeer.h.
|
protected |
Definition at line 243 of file BaseHTTPPeer.h.
|
protected |
Definition at line 254 of file BaseHTTPPeer.h.
|
protected |
Definition at line 262 of file BaseHTTPPeer.h.
|
protected |
Definition at line 272 of file BaseHTTPPeer.h.
|
protected |
Definition at line 292 of file BaseHTTPPeer.h.
|
protected |
Definition at line 338 of file BaseHTTPPeer.h.
|
protectedpure virtual |
Implemented in xrpl::PlainHTTPPeer< Handler >, and xrpl::SSLHTTPPeer< Handler >.
|
protectedpure virtual |
Implemented in xrpl::PlainHTTPPeer< Handler >, and xrpl::SSLHTTPPeer< Handler >.
|
overrideprotectedvirtual |
Returns the Journal to use for logging.
Implements xrpl::Session.
Definition at line 140 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the Port settings for this connection.
Implements xrpl::Session.
Definition at line 146 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the remote address of the connection.
Implements xrpl::Session.
Definition at line 152 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the current HTTP request.
Implements xrpl::Session.
Definition at line 158 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Implements xrpl::Session.
Definition at line 388 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Implements xrpl::Session.
Definition at line 410 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Detach the session.
This holds the session open so that the response can be sent asynchronously. Calls to io_context::run made by the server will not return until all detached sessions are closed.
Implements xrpl::Session.
Definition at line 426 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Indicate that the response is complete.
The handler should call this when it has completed writing the response. If Keep-Alive is indicated on the connection, this will trigger a read for the next request; else, the connection will be closed when all remaining data has been sent.
Implements xrpl::Session.
Definition at line 435 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Close the session.
This will be performed asynchronously. The session will be closed gracefully after all pending writes have completed.
| graceful | true to wait until all data has finished sending. |
Implements xrpl::Session.
Definition at line 465 of file BaseHTTPPeer.h.
|
privateinherited |
|
inherited |
Return the IOList associated with the work.
Requirements: The call to IOList::emplace to create the work has already returned.
|
inherited |
|
inherited |
|
pure virtualinherited |
Convert the connection to WebSocket.
Implemented in xrpl::PlainHTTPPeer< Handler >, and xrpl::SSLHTTPPeer< Handler >.
|
staticconstexprprotected |
Definition at line 41 of file BaseHTTPPeer.h.
|
staticconstexprprotected |
Definition at line 42 of file BaseHTTPPeer.h.
|
staticconstexprprotected |
Definition at line 43 of file BaseHTTPPeer.h.
|
protected |
Definition at line 57 of file BaseHTTPPeer.h.
|
protected |
Definition at line 58 of file BaseHTTPPeer.h.
|
protected |
Definition at line 59 of file BaseHTTPPeer.h.
|
protected |
Definition at line 60 of file BaseHTTPPeer.h.
|
protected |
Definition at line 61 of file BaseHTTPPeer.h.
|
protected |
Definition at line 62 of file BaseHTTPPeer.h.
|
protected |
Definition at line 64 of file BaseHTTPPeer.h.
|
protected |
Definition at line 65 of file BaseHTTPPeer.h.
|
protected |
Definition at line 67 of file BaseHTTPPeer.h.
|
protected |
Definition at line 68 of file BaseHTTPPeer.h.
|
protected |
Definition at line 69 of file BaseHTTPPeer.h.
|
protected |
Definition at line 70 of file BaseHTTPPeer.h.
|
protected |
Definition at line 71 of file BaseHTTPPeer.h.
|
protected |
Definition at line 72 of file BaseHTTPPeer.h.
|
protected |
Definition at line 73 of file BaseHTTPPeer.h.
|
protected |
Definition at line 74 of file BaseHTTPPeer.h.
|
protected |
Definition at line 76 of file BaseHTTPPeer.h.
|
protected |
Definition at line 77 of file BaseHTTPPeer.h.
|
protected |
Definition at line 78 of file BaseHTTPPeer.h.
|
privateinherited |