#include <ControllerWatcher.hpp>
Public Member Functions | |
| ControllerWatcher (const std::vector< ControllerInfo > &controllerList, ControllerStateChangedCallback *callbackPtr, int pingDelayInMs, int controllerTimeout) throw (ConnectionException, UnexpectedException) | |
| Creates a controller watcher with the given controllers to watch. | |
| void | run () |
| Starts watching controllers. | |
| void | stop () |
| Stops the execution. | |
| void | forceControllerDown (const ControllerInfo &c) |
| Forces a given controller to be considered as not responding. | |
Protected Member Functions | |
| WatchedControllers * | getControllersPtr () |
| Gets the watched controllers to delete. | |
| pthread_t | getPingerThread () |
| Gets the pinger thread to stop him. | |
| ControllerPingSender * | getControllerPingSenderPtr () |
| Gets the ControllerPingSender to delete. | |
| int | getSocketFd () |
| Gets the socket file descriptor to close. | |
Friends | |
| void * | ControllerWatcherThread (void *) |
| Function to be passed to pthread_create. | |
Launches a controller pinger thread and creates a list of controllers with their states. Reads controllers responses (pongs) and updates state accordingly
| CarobNS::ControllerWatcher::ControllerWatcher | ( | const std::vector< ControllerInfo > & | controllerList, | |
| ControllerStateChangedCallback * | callbackPtr, | |||
| int | pingDelayInMs, | |||
| int | controllerTimeout | |||
| ) | throw (ConnectionException, UnexpectedException) |
Creates a controller watcher with the given controllers to watch.
Pings will be sent to all given controllers
| controllerList | controllers to ping | |
| callbackPtr | Callback implementation to call when a controller state changes | |
| pingDelayInMs | time to wait between two successive pings | |
| controllerTimeout | delay after which a controller will be considered as failing if it did not respond to pings |
| void CarobNS::ControllerWatcher::forceControllerDown | ( | const ControllerInfo & | c | ) |
Forces a given controller to be considered as not responding.
| c | controller that is suspected of failure |
| void CarobNS::ControllerWatcher::run | ( | ) |
Starts watching controllers.
Reads ping responses from controllers and updates corresponding controller data in the ControllerList.
| void* ControllerWatcherThread | ( | void * | ) | [friend] |
Function to be passed to pthread_create.
Launches run on given ControllerWatcher instance
1.4.7