unilink  0.4.3
A simple C++ library for unified async communication
reconnect_policy.hpp File Reference
#include <algorithm>
#include <chrono>
#include <cmath>
#include <functional>
#include <memory>
#include <mutex>
#include <random>
#include <thread>
#include "unilink/diagnostics/error_types.hpp"

Go to the source code of this file.

Classes

struct  unilink::ReconnectDecision
 Represents a decision on whether to retry a connection attempt. More...
 

Namespaces

 

Typedefs

using unilink::ReconnectPolicy = std::function< ReconnectDecision(const diagnostics::ErrorInfo &, uint32_t)>
 Function type for determining reconnection policy. More...
 

Functions

ReconnectPolicy unilink::FixedInterval (std::chrono::milliseconds delay)
 Creates a policy that retries with a fixed interval. More...
 
ReconnectPolicy unilink::ExponentialBackoff (std::chrono::milliseconds min_delay, std::chrono::milliseconds max_delay, double factor=2.0, bool jitter=true)
 Creates a policy that retries with exponential backoff. More...