libfilezilla
|
A compound rate-limited socket layer. More...
#include <rate_limited_layer.hpp>
Public Member Functions | |
compound_rate_limited_layer (event_handler *handler, socket_interface &next_layer) | |
void | add_limiter (rate_limiter *limiter) |
void | remove_limiter (rate_limiter *limiter) |
virtual int | read (void *buffer, unsigned int size, int &error) override |
virtual int | write (void const *buffer, unsigned int size, int &error) override |
virtual socket_state | get_state () const override |
virtual int | connect (native_string const &host, unsigned int port, address_type family=address_type::unknown) override |
virtual int | shutdown () override |
Signals peers that we want to close the connections. More... | |
virtual void | set_event_handler (event_handler *handler, fz::socket_event_flag retrigger_block=socket_event_flag{}) override |
The handler for any events generated (or forwarded) by this layer. | |
Public Member Functions inherited from socket_layer | |
socket_layer (event_handler *handler, socket_interface &next_layer, bool event_passthrough) | |
socket_layer (socket_layer const &)=delete | |
socket_layer & | operator= (socket_layer const &)=delete |
virtual native_string | peer_host () const override |
virtual int | peer_port (int &error) const override |
socket_interface & | next () |
The next layer further down. Usually another layer or the actual socket. | |
virtual int | shutdown_read () override |
Check that all layers further down also have reached EOF. More... | |
Public Member Functions inherited from socket_interface | |
socket_interface (socket_interface const &)=delete | |
socket_interface & | operator= (socket_interface const &)=delete |
template<typename T , std::enable_if_t< std::is_signed_v< T >, int > = 0> | |
int | read (void *buffer, T size, int &error) |
template<typename T , std::enable_if_t< std::is_unsigned_v< T > &&(sizeof(T) > sizeof(unsigned int)), int > = 0> | |
int | read (void *buffer, T size, int &error) |
template<typename T , std::enable_if_t< std::is_signed_v< T >, int > = 0> | |
int | write (void const *buffer, T size, int &error) |
template<typename T , std::enable_if_t< std::is_unsigned_v< T > &&(sizeof(T) > sizeof(unsigned int)), int > = 0> | |
int | write (void const *buffer, T size, int &error) |
Public Member Functions inherited from socket_event_source | |
socket_event_source * | root () const |
Gets the root source. More... | |
Protected Attributes | |
std::vector< std::unique_ptr< crll_bucket > > | buckets_ |
fz::mutex | mtx_ {false} |
Protected Attributes inherited from socket_layer | |
event_handler * | event_handler_ {} |
socket_interface & | next_layer_ |
bool | event_passthrough_ {} |
Protected Attributes inherited from socket_event_source | |
socket_event_source *const | root_ {} |
Friends | |
class | crll_bucket |
Additional Inherited Members | |
Protected Member Functions inherited from socket_layer | |
void | forward_socket_event (socket_event_source *source, socket_event_flag t, int error) |
void | forward_hostaddress_event (socket_event_source *source, std::string const &address) |
void | set_event_passthrough (socket_event_flag retrigger_block=socket_event_flag{}) |
Protected Member Functions inherited from socket_interface | |
socket_interface (socket_event_source *root) | |
Protected Member Functions inherited from socket_event_source | |
socket_event_source (socket_event_source *root) | |
A compound rate-limited socket layer.
A socket layer to which any number of
|
inlineoverridevirtual |
Signals peers that we want to close the connections.
Only disallows further sends, does not affect reading from the socket.
Returns 0 on success, an error code otherwise. If it returns EGAIN, shutdown is not yet complete. Call shutdown again after the next write event.
Reimplemented from socket_layer.