ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
host_liveness_t Struct Reference

When code needs to work with host liveness, it keeps last_ping_sent_ms, last_pong_received_ms, consecutive_failures, max_failures here instead of scattering it across globals. Initialization establishes the handles and sizes; teardown must release any allocation, lock, thread, or callback context recorded in those fields. More...

#include <src/discovery/session.h>

Data Fields

uint64_t last_ping_sent_ms
 Timestamp of last ping sent (monotonic).
atomic_t last_pong_received_ms
 Timestamp of last pong received (monotonic).
uint32_t consecutive_failures
 Number of consecutive ping failures.
uint32_t max_failures
 Threshold for triggering migration (default: 3).
uint64_t ping_interval_ms
 Time between pings (default: 3000ms).
uint64_t timeout_ms
 Timeout for ping response (default: 10000ms).
bool ping_in_flight
 True if waiting for pong.

Detailed Description

When code needs to work with host liveness, it keeps last_ping_sent_ms, last_pong_received_ms, consecutive_failures, max_failures here instead of scattering it across globals. Initialization establishes the handles and sizes; teardown must release any allocation, lock, thread, or callback context recorded in those fields.

Host liveness detection state

Participants periodically ping the host to detect disconnects. After 3 consecutive ping failures (10s timeout each), host migration is triggered.

Definition at line 57 of file src/discovery/session.h.

Field Documentation

◆ consecutive_failures

uint32_t host_liveness_t::consecutive_failures

Number of consecutive ping failures.

Definition at line 60 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), discovery_session_check_host_alive(), and discovery_session_create().

◆ last_ping_sent_ms

uint64_t host_liveness_t::last_ping_sent_ms

Timestamp of last ping sent (monotonic).

Definition at line 58 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), discovery_session_check_host_alive(), and discovery_session_create().

◆ last_pong_received_ms

atomic_t host_liveness_t::last_pong_received_ms

◆ max_failures

uint32_t host_liveness_t::max_failures

Threshold for triggering migration (default: 3).

Definition at line 61 of file src/discovery/session.h.

Referenced by discovery_session_check_host_alive(), and discovery_session_create().

◆ ping_in_flight

bool host_liveness_t::ping_in_flight

True if waiting for pong.

Definition at line 64 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), discovery_session_check_host_alive(), and discovery_session_create().

◆ ping_interval_ms

uint64_t host_liveness_t::ping_interval_ms

Time between pings (default: 3000ms).

Definition at line 62 of file src/discovery/session.h.

Referenced by discovery_session_check_host_alive(), and discovery_session_create().

◆ timeout_ms

uint64_t host_liveness_t::timeout_ms

Timeout for ping response (default: 10000ms).

Definition at line 63 of file src/discovery/session.h.

Referenced by discovery_session_check_host_alive(), and discovery_session_create().


The documentation for this struct was generated from the following file: