$darkmode
#include <tcp_transceiver.hpp>
Public Member Functions | |
| TcpTransceiverFactory (int attempts, std::chrono::duration< float > delay) | |
| TcpTransceiverFactory (const TcpTransceiverConfiguration &c) | |
| TcpTransceiverFactory (TcpTransceiverConfiguration &&c) | |
| int | retry_attempts () const |
| void | set_retry_attempts (int attempts) |
| std::chrono::duration< float > | retry_delay () const |
| void | set_retry_delay (std::chrono::duration< float > delay) |
| std::unique_ptr< T > | create_or_null (const std::string &host, uint16_t port) const |
| std::unique_ptr< T > | create_or_throw (const std::string &host, uint16_t port) const |
| std::unique_ptr< T > | create_or_throw (const std::string &host, uint16_t port, AbortFlag &sig) const |
Protected Member Functions | |
| virtual Logger | factory_logger () const =0 |
| virtual const char * | instance_name () const =0 |
Protected Attributes | |
| TcpTransceiverConfiguration | config_ |
Friends | |
| void | to_json (Json &j, const TcpTransceiverFactory< T > &f) |
| void | from_json (const Json &j, TcpTransceiverFactory< T > &f) |
TcpTransceiverFactory helps you create TcpTransceiver types by retrying connection attempts a configurable number of times.
There are two values that can currently be configured: retry attempts and retry delay.
Retry attempts (retry_attempts) is the number of attempts to retry after connection failure. The value 0 indicates no attempts and is effectively the same as not using this factory. Any negative value indicates an infinite number of connection attempts; this is not recommended, but can be useful in certain circumstances.
The retry delay (retry_delay) is fraction of time in seconds that should be waited between connection attempts. The value 0 indicates that no time is waited, and is not recommended, as this can tie up your system.
|
inline |
Create a TcpTransceiver derived type or return nullptr.
|
inline |
Create an RdbTranscieverTcp or throw a std::ios_base::failure.
|
inline |
Create an RdbTranscieverTcp or throw a std::ios_base::failure.
If an abort is signalled, an AsyncAbort is thrown.