transport: per-peer sleep callback (peer_sleep_cbk) fired from keepalive protocol
This commit is contained in:
1 parent
5628138d16
commit
e4e9fca243
5 files changed
+67
No files matched your search
@@ -99,6 +99,16 @@ struct utun_activity_cbk_entry {
|
||||
struct utun_activity_cbk_entry* next;
|
||||
};
|
||||
|
||||
// Подписка на смену спячки пира (keepalive-протокол). Сервер (или любой узел)
|
||||
// получает от мобильного пира sleep-анонс и уведомляет подписчиков:
|
||||
// sleeping=1 — пир ушёл в спячку (в фон), 0 — проснулся (дедлайн истёк / обычный keepalive).
|
||||
typedef void (*peer_sleep_cbk_fn)(struct UTUN_INSTANCE* instance, uint64_t peer_node_id, int sleeping, void* arg);
|
||||
struct peer_sleep_cbk_entry {
|
||||
peer_sleep_cbk_fn fn;
|
||||
void* arg;
|
||||
struct peer_sleep_cbk_entry* next;
|
||||
};
|
||||
|
||||
// uTun instance configuration
|
||||
struct UTUN_INSTANCE {
|
||||
// Identification
|
||||
@@ -221,6 +231,7 @@ struct UTUN_INSTANCE {
|
||||
uint8_t client_activity; // CLIENT_ACTIVITY_STANDBY/ACTIVE
|
||||
void* client_activity_timer; // uasync timer handle for inactivity timeout
|
||||
struct utun_activity_cbk_entry* activity_cbks; // подписки на смену client_activity
|
||||
struct peer_sleep_cbk_entry* peer_sleep_cbks; // подписки на смену спячки пира (keepalive)
|
||||
uint8_t standby_enabled; // 1 = standby duty-cycle активен (chatgui-android)
|
||||
|
||||
// TCP proxy server (exit node)
|
||||
@@ -259,6 +270,9 @@ void utun_instance_set_topo_group_enabled(int enabled);
|
||||
void utun_set_client_activity(struct UTUN_INSTANCE* instance, int active);
|
||||
void utun_add_activity_cbk(struct UTUN_INSTANCE* instance, utun_activity_cbk_fn fn, void* arg);
|
||||
void utun_remove_activity_cbk(struct UTUN_INSTANCE* instance, utun_activity_cbk_fn fn, void* arg);
|
||||
void utun_add_peer_sleep_cbk(struct UTUN_INSTANCE* instance, peer_sleep_cbk_fn fn, void* arg);
|
||||
void utun_remove_peer_sleep_cbk(struct UTUN_INSTANCE* instance, peer_sleep_cbk_fn fn, void* arg);
|
||||
void utun_fire_peer_sleep_cbk(struct UTUN_INSTANCE* instance, uint64_t peer_node_id, int sleeping);
|
||||
|
||||
// Diagnostic function for memory leak analysis
|
||||
void utun_instance_diagnose_leaks(struct UTUN_INSTANCE* instance, const char* phase);
|
||||
|
||||
Reference in new issue
Block a user