rippled
|
Represents an active connection. More...
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. More... | |
virtual std::shared_ptr< WSSession > | websocketUpgrade ()=0 |
Convert the connection to WebSocket. More... | |
Public Attributes | |
void * | tag = nullptr |
A user-definable pointer. More... | |
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. More... | |
Port const & | port () override |
Returns the Port settings for this connection. More... | |
beast::IP::Endpoint | remoteAddress () override |
Returns the remote address of the connection. More... | |
http_request_type & | request () override |
Returns the current HTTP request. More... | |
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. More... | |
void | complete () override |
Indicate that the response is complete. More... | |
void | close (bool graceful) override |
Close the session. More... | |
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_ |
const beast::Journal | 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 49 of file BaseHTTPPeer.h.
|
protected |
Definition at line 52 of file BaseHTTPPeer.h.
|
protected |
Definition at line 53 of file BaseHTTPPeer.h.
|
protected |
Definition at line 54 of file BaseHTTPPeer.h.
|
protected |
Definition at line 55 of file BaseHTTPPeer.h.
|
protected |
Enumerator | |
---|---|
bufferSize | |
timeoutSeconds | |
timeoutSecondsLocal |
Definition at line 57 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 208 of file BaseHTTPPeer.h.
|
virtual |
Definition at line 231 of file BaseHTTPPeer.h.
Session& ripple::BaseHTTPPeer< Handler, Impl >::session | ( | ) |
Definition at line 117 of file BaseHTTPPeer.h.
|
overridevirtual |
Implements ripple::io_list::work.
Definition at line 241 of file BaseHTTPPeer.h.
|
protected |
Definition at line 127 of file BaseHTTPPeer.h.
|
protected |
Definition at line 256 of file BaseHTTPPeer.h.
|
protected |
Definition at line 269 of file BaseHTTPPeer.h.
|
protected |
Definition at line 280 of file BaseHTTPPeer.h.
|
protected |
Definition at line 288 of file BaseHTTPPeer.h.
|
protected |
Definition at line 299 of file BaseHTTPPeer.h.
|
protected |
Definition at line 320 of file BaseHTTPPeer.h.
|
protected |
Definition at line 368 of file BaseHTTPPeer.h.
|
protectedpure virtual |
Implemented in ripple::SSLHTTPPeer< Handler >, and ripple::PlainHTTPPeer< Handler >.
|
protectedpure virtual |
Implemented in ripple::SSLHTTPPeer< Handler >, and ripple::PlainHTTPPeer< Handler >.
|
overrideprotectedvirtual |
Returns the Journal to use for logging.
Implements ripple::Session.
Definition at line 165 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the Port settings for this connection.
Implements ripple::Session.
Definition at line 171 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the remote address of the connection.
Implements ripple::Session.
Definition at line 177 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Returns the current HTTP request.
Implements ripple::Session.
Definition at line 183 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Implements ripple::Session.
Definition at line 421 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Implements ripple::Session.
Definition at line 446 of file BaseHTTPPeer.h.
|
overrideprotectedvirtual |
Detach the session.
This holds the session open so that the response can be sent asynchronously. Calls to io_service::run made by the server will not return until all detached sessions are closed.
Implements ripple::Session.
Definition at line 464 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 473 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 504 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::SSLHTTPPeer< Handler >, and ripple::PlainHTTPPeer< Handler >.
|
protected |
Definition at line 79 of file BaseHTTPPeer.h.
|
protected |
Definition at line 80 of file BaseHTTPPeer.h.
|
protected |
Definition at line 81 of file BaseHTTPPeer.h.
|
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 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 91 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 98 of file BaseHTTPPeer.h.
|
protected |
Definition at line 99 of file BaseHTTPPeer.h.
|
protected |
Definition at line 100 of file BaseHTTPPeer.h.
|
privateinherited |