SNode.C
Loading...
Searching...
No Matches
core::socket::stream::AutoConnectControl Class Reference

#include <AutoConnectControl.h>

Inheritance diagram for core::socket::stream::AutoConnectControl:
Collaboration diagram for core::socket::stream::AutoConnectControl:

Public Member Functions

 AutoConnectControl ()
 AutoConnectControl (const AutoConnectControl &)=delete
AutoConnectControloperator= (const AutoConnectControl &)=delete
 AutoConnectControl (AutoConnectControl &&)=delete
AutoConnectControloperator= (AutoConnectControl &&)=delete
 ~AutoConnectControl ()
void stopRetry ()
void stopReconnect ()
void stopReconnectAndRetry ()
bool isRetryEnabled () const
bool isReconnectEnabled () const

Private Member Functions

void armRetryTimer (double timeoutSeconds, const std::function< void()> &dispatcher)
void armReconnectTimer (double timeoutSeconds, const std::function< void()> &dispatcher)
void cancelRetryTimer ()
void cancelReconnectTimer ()

Private Attributes

bool retryEnabled {true}
bool reconnectEnabled {true}
bool cancelRetryScheduled {false}
bool cancelReconnectScheduled {false}
std::unique_ptr< core::timer::TimerretryTimer
std::unique_ptr< core::timer::TimerreconnectTimer

Friends

template<typename SocketConnectorT, typename SocketContextFactoryT, typename... Args>
class SocketClient
template<typename SocketAcceptorT, typename SocketContextFactoryT, typename... Args>
class SocketServer

Detailed Description

Definition at line 70 of file AutoConnectControl.h.

Constructor & Destructor Documentation

◆ AutoConnectControl() [1/3]

core::socket::stream::AutoConnectControl::AutoConnectControl ( )
default

◆ AutoConnectControl() [2/3]

core::socket::stream::AutoConnectControl::AutoConnectControl ( const AutoConnectControl & )
delete

◆ AutoConnectControl() [3/3]

core::socket::stream::AutoConnectControl::AutoConnectControl ( AutoConnectControl && )
delete

◆ ~AutoConnectControl()

core::socket::stream::AutoConnectControl::~AutoConnectControl ( )
default

Member Function Documentation

◆ armReconnectTimer()

void core::socket::stream::AutoConnectControl::armReconnectTimer ( double timeoutSeconds,
const std::function< void()> & dispatcher )
private

Definition at line 90 of file AutoConnectControl.cpp.

90 {
91 if (reconnectEnabled) {
92 reconnectTimer = std::make_unique<core::timer::Timer>(core::timer::Timer::singleshotTimer(dispatcher, timeoutSeconds));
93 }
94 }
std::unique_ptr< core::timer::Timer > reconnectTimer
static Timer singleshotTimer(const std::function< void()> &dispatcher, const utils::Timeval &timeout)
Definition Timer.cpp:57

References reconnectEnabled, reconnectTimer, and core::timer::Timer::singleshotTimer().

Here is the call graph for this function:

◆ armRetryTimer()

void core::socket::stream::AutoConnectControl::armRetryTimer ( double timeoutSeconds,
const std::function< void()> & dispatcher )
private

Definition at line 84 of file AutoConnectControl.cpp.

84 {
85 if (retryEnabled) {
86 retryTimer = std::make_unique<core::timer::Timer>(core::timer::Timer::singleshotTimer(dispatcher, timeoutSeconds));
87 }
88 }
std::unique_ptr< core::timer::Timer > retryTimer

References retryEnabled, retryTimer, and core::timer::Timer::singleshotTimer().

Here is the call graph for this function:

◆ cancelReconnectTimer()

void core::socket::stream::AutoConnectControl::cancelReconnectTimer ( )
private

Definition at line 103 of file AutoConnectControl.cpp.

103 {
104 if (reconnectTimer) {
105 reconnectTimer->cancel();
106 reconnectTimer.reset();
107 }
108 }

References core::Timer::cancel(), and reconnectTimer.

Referenced by stopReconnect(), and stopReconnectAndRetry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelRetryTimer()

void core::socket::stream::AutoConnectControl::cancelRetryTimer ( )
private

Definition at line 96 of file AutoConnectControl.cpp.

96 {
97 if (retryTimer) {
98 retryTimer->cancel();
99 retryTimer.reset();
100 }
101 }

References core::Timer::cancel(), and retryTimer.

Referenced by stopReconnectAndRetry(), and stopRetry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isReconnectEnabled()

bool core::socket::stream::AutoConnectControl::isReconnectEnabled ( ) const

Definition at line 80 of file AutoConnectControl.cpp.

80 {
81 return reconnectEnabled;
82 }

References reconnectEnabled.

◆ isRetryEnabled()

bool core::socket::stream::AutoConnectControl::isRetryEnabled ( ) const

Definition at line 76 of file AutoConnectControl.cpp.

76 {
77 return retryEnabled;
78 }

References retryEnabled.

◆ operator=() [1/2]

AutoConnectControl & core::socket::stream::AutoConnectControl::operator= ( AutoConnectControl && )
delete

◆ operator=() [2/2]

AutoConnectControl & core::socket::stream::AutoConnectControl::operator= ( const AutoConnectControl & )
delete

◆ stopReconnect()

void core::socket::stream::AutoConnectControl::stopReconnect ( )

Definition at line 62 of file AutoConnectControl.cpp.

References cancelReconnectTimer(), and reconnectEnabled.

Here is the call graph for this function:

◆ stopReconnectAndRetry()

void core::socket::stream::AutoConnectControl::stopReconnectAndRetry ( )

Definition at line 68 of file AutoConnectControl.cpp.

References cancelReconnectTimer(), cancelRetryTimer(), reconnectEnabled, and retryEnabled.

Here is the call graph for this function:

◆ stopRetry()

void core::socket::stream::AutoConnectControl::stopRetry ( )

Definition at line 56 of file AutoConnectControl.cpp.

56 {
57 retryEnabled = false;
58
60 }

References cancelRetryTimer(), and retryEnabled.

Here is the call graph for this function:

◆ SocketClient

template<typename SocketConnectorT, typename SocketContextFactoryT, typename... Args>
friend class SocketClient
friend

Definition at line 108 of file AutoConnectControl.h.

◆ SocketServer

template<typename SocketAcceptorT, typename SocketContextFactoryT, typename... Args>
friend class SocketServer
friend

Definition at line 113 of file AutoConnectControl.h.

Member Data Documentation

◆ cancelReconnectScheduled

bool core::socket::stream::AutoConnectControl::cancelReconnectScheduled {false}
private

Definition at line 100 of file AutoConnectControl.h.

100{false};

◆ cancelRetryScheduled

bool core::socket::stream::AutoConnectControl::cancelRetryScheduled {false}
private

Definition at line 99 of file AutoConnectControl.h.

99{false};

◆ reconnectEnabled

bool core::socket::stream::AutoConnectControl::reconnectEnabled {true}
private

Definition at line 97 of file AutoConnectControl.h.

97{true};

Referenced by armReconnectTimer(), isReconnectEnabled(), stopReconnect(), and stopReconnectAndRetry().

◆ reconnectTimer

std::unique_ptr<core::timer::Timer> core::socket::stream::AutoConnectControl::reconnectTimer
private

Definition at line 103 of file AutoConnectControl.h.

Referenced by armReconnectTimer(), and cancelReconnectTimer().

◆ retryEnabled

bool core::socket::stream::AutoConnectControl::retryEnabled {true}
private

Definition at line 96 of file AutoConnectControl.h.

96{true};

Referenced by armRetryTimer(), isRetryEnabled(), stopReconnectAndRetry(), and stopRetry().

◆ retryTimer

std::unique_ptr<core::timer::Timer> core::socket::stream::AutoConnectControl::retryTimer
private

Definition at line 102 of file AutoConnectControl.h.

Referenced by armRetryTimer(), and cancelRetryTimer().


The documentation for this class was generated from the following files: