#include <ControllerPinger.hpp>
Public Member Functions | |
void | suspectControllerOfFailure (ControllerInfo &controllerInfoPrm) |
Adds the given controller to the list of suspects. | |
bool | isSuspectedOfFailure (const ControllerInfo &controllerInfoPrm) |
Returns true if the specified controller is suspected of failure. | |
void | run () |
Tries to connect to each suspected controller with a non-blocking connect and checks the connection state. | |
Static Public Member Functions | |
static ControllerPinger & | getInstance () |
Singleton-access function: retrieves the existing or newly created instance of the ControllerPinger. | |
static int | getNumberOfFailures () |
Gives the number of controller failures since this process started. |
Used by controller pools, provides 3 main functions: one for adding a suspect in the list, one for knowing if a controller is already suspected, and on to update the list (ping the controllers to check if they are up again
void CarobNS::ControllerPinger::suspectControllerOfFailure | ( | ControllerInfo & | controllerInfoPrm | ) |
Adds the given controller to the list of suspects.
The given controllerInfo argument will be *copied* in the suspected controllers list, but this function will modify the given controller info by setting its failure_number field
controllerInfoPrm | the controller suspected of failure |
bool CarobNS::ControllerPinger::isSuspectedOfFailure | ( | const ControllerInfo & | controllerInfoPrm | ) |
Returns true if the specified controller is suspected of failure.
controllerInfoPrm | the controller to check |
void CarobNS::ControllerPinger::run | ( | ) |
Tries to connect to each suspected controller with a non-blocking connect and checks the connection state.
In case of connection success, send the ping command and remove the controller from the suspect list.