|
rippled
|
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 remote_address, ConstBufferSequence const &buffers) | |
| virtual | ~BaseHTTPPeer () |
| Session & | session () |
| void | close () override |
| io_list & | ios () |
| Return the io_list associated with the work. | |
| virtual std::shared_ptr< WSSession > | websocketUpgrade ()=0 |
| Convert the connection to WebSocket. | |
| void | write (std::string const &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 | |
| enum | { bufferSize = 4 * 1024 , timeoutSeconds = 30 , timeoutSecondsLocal = 3 } |
| 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 | start_timer () |
| void | cancel_timer () |
| void | on_timer () |
| void | do_read (yield_context do_yield) |
| void | on_write (error_code const &ec, std::size_t bytes_transferred) |
| void | do_writer (std::shared_ptr< Writer > const &writer, bool keep_alive, yield_context do_yield) |
| virtual void | do_request ()=0 |
| virtual void | do_close ()=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 keep_alive) 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 | remote_address_ |
| beast::Journal const | journal_ |
| std::string | id_ |
| std::size_t | nid_ |
| boost::asio::streambuf | read_buf_ |
| 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 | request_count_ = 0 |
| std::size_t | bytes_in_ = 0 |
| std::size_t | bytes_out_ = 0 |
Private Member Functions | |
| template<class = void> | |
| void | destroy () |
Private Attributes | |
| io_list * | ios_ = nullptr |
Represents an active connection.
Definition at line 52 of file BaseHTTPPeer.h.
|
protected |
Definition at line 55 of file BaseHTTPPeer.h.
|
protected |
Definition at line 56 of file BaseHTTPPeer.h.
|
protected |
Definition at line 57 of file BaseHTTPPeer.h.
|
protected |
Definition at line 58 of file BaseHTTPPeer.h.
|
protected |
| Enumerator | |
|---|---|
| bufferSize | |
| timeoutSeconds | |
| timeoutSecondsLocal | |
Definition at line 60 of file BaseHTTPPeer.h.
| ripple::BaseHTTPPeer< Handler, Impl >::BaseHTTPPeer | ( | Port const & | port, |
| Handler & | handler, | ||
| boost::asio::executor const & | executor, | ||
| beast::Journal | journal, | ||
| endpoint_type | remote_address, | ||
| ConstBufferSequence const & | buffers | ||
| ) |
Definition at line 211 of file BaseHTTPPeer.h.
|
virtual |
Definition at line 234 of file BaseHTTPPeer.h.
| Session & ripple::BaseHTTPPeer< Handler, Impl >::session | ( | ) |
Definition at line 120 of file BaseHTTPPeer.h.
|
overridevirtual |
Implements ripple::io_list::work.
Definition at line 244 of file BaseHTTPPeer.h.
|
protected |
Definition at line 130 of file BaseHTTPPeer.h.
|
protected |
Definition at line 259 of file BaseHTTPPeer.h.
|
protected |
Definition at line 272 of file BaseHTTPPeer.h.
|
protected |
Definition at line 283 of file BaseHTTPPeer.h.
|
protected |
Definition at line 291 of file BaseHTTPPeer.h.
|
protected |
Definition at line 302 of file BaseHTTPPeer.h.
|
protected |
Definition at line 323 of file BaseHTTPPeer.h.
|
protected |
Definition at line 371 of file BaseHTTPPeer.h.
|
protectedpure virtual |
Implemented in ripple::PlainHTTPPeer< Handler >, and ripple::SSLHTTPPeer< Handler >.
|
protectedpure virtual |
Implemented in ripple::PlainHTTPPeer< Handler >, and ripple::SSLHTTPPeer< Handler >.
|
overrideprotectedvirtual |
Returns the Journal to use for logging.
Implements ripple::Session.
Definition at line 168 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the Port settings for this connection.
Implements ripple::Session.
Definition at line 174 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the remote address of the connection.
Implements ripple::Session.
Definition at line 180 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the current HTTP request.
Implements ripple::Session.
Definition at line 186 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Implements ripple::Session.
Definition at line 424 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Implements ripple::Session.
Definition at line 449 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 ripple::Session.
Definition at line 467 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 ripple::Session.
Definition at line 476 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 ripple::Session.
Definition at line 507 of file BaseHTTPPeer.h.
|
privateinherited |
|
inherited |
Return the io_list associated with the work.
Requirements: The call to io_list::emplace to create the work has already returned.
|
inherited |
|
inherited |
|
pure virtualinherited |
Convert the connection to WebSocket.
Implemented in ripple::PlainHTTPPeer< Handler >, and ripple::SSLHTTPPeer< Handler >.
|
protected |
Definition at line 82 of file BaseHTTPPeer.h.
|
protected |
Definition at line 83 of file BaseHTTPPeer.h.
|
protected |
Definition at line 84 of file BaseHTTPPeer.h.
|
protected |
Definition at line 85 of file BaseHTTPPeer.h.
|
protected |
Definition at line 86 of file BaseHTTPPeer.h.
|
protected |
Definition at line 87 of file BaseHTTPPeer.h.
|
protected |
Definition at line 89 of file BaseHTTPPeer.h.
|
protected |
Definition at line 90 of file BaseHTTPPeer.h.
|
protected |
Definition at line 92 of file BaseHTTPPeer.h.
|
protected |
Definition at line 93 of file BaseHTTPPeer.h.
|
protected |
Definition at line 94 of file BaseHTTPPeer.h.
|
protected |
Definition at line 95 of file BaseHTTPPeer.h.
|
protected |
Definition at line 96 of file BaseHTTPPeer.h.
|
protected |
Definition at line 97 of file BaseHTTPPeer.h.
|
protected |
Definition at line 98 of file BaseHTTPPeer.h.
|
protected |
Definition at line 99 of file BaseHTTPPeer.h.
|
protected |
Definition at line 101 of file BaseHTTPPeer.h.
|
protected |
Definition at line 102 of file BaseHTTPPeer.h.
|
protected |
Definition at line 103 of file BaseHTTPPeer.h.
|
privateinherited |