Skip to content

C++ Implementation of Heartbeating

Simon Spannagel requested to merge p-heartbeats into main

This MR implements heartbeating for the C++ satellite implementations. Current features:

  • Automatic offers for heartbeats via CHIRP
  • Sending of heartbeats in regular intervals, sending of extrasystoles whenever the state changes. This is done by waiting on the sender thread for either the timer to expire or the state to change. This ensures that we are sending only from one thread on the socket.
  • Request for heartbeats via CHIRP, automatic subscription for any incoming OFFER
  • Reception of heartbeats from remote CHP hosts, decoding of the message
  • Bookkeeping of last heartbeat state, time, and the current interval. Counting of lives.
  • Checking is paused until we expect the next heartbeat to expire, wakeup for state changes
  • Callback to FSM::interrupt once the lives ran out
  • Callback to FSM::interrupt when ERROR state is detected

This needs improvement:

  • Revisit zmq::active_poller_t since it's in the draft API. Seems to make problems in the CI with precompiled libzmq.
  • Tests
  • Handling of departures from peers - this should still trigger an interrupt I guess?
  • Better logging - e.g. when in NEW and someone disappears I don't want to see this as warning
  • Discuss how importance and startup sequence (!82) could fit into this
  • Should the interval be accessible to the user, i.e. allow updating?
  • Review locking/threading approach
Edited by Simon Spannagel

Merge request reports

Loading