dm: прямой обмен сообщениями (DM) + soundtouch + архитектура звонков
- src/dm/: dm_core/dm_crypto/dm_mailbox — прямой обмен сообщениями (DM) - lib/soundtouch-master/: vendored SoundTouch (изменение темпа/высоты аудио) - doc/dm_arch.md, doc/chat_call_arch.md: архитектура DM и звонков - tests: test_dm.c, test_dm_e2e.c - chat: рефакторинг chat_* модулей, member_sync, invite_build - chatgui/chatgui-android: синхронизация с новым API чата - lib/u_async, debug_config, utun_instance: сопутствующие изменения
This commit is contained in:
1 parent
761f64cf76
commit
73fe99b33f
123 files changed
+14095
-1270
No files matched your search
+23
-27
@@ -240,25 +240,25 @@ static int _member_get_items(void* ctx, const char* ns, uint8_t level,
|
||||
/* ── node_props_changed (adm_tags) callbacks ── */
|
||||
|
||||
struct ms_props_cbk { node_props_changed_fn fn; void* arg; struct ms_props_cbk* next; };
|
||||
static struct ms_props_cbk* g_props_cbks = NULL;
|
||||
|
||||
static void _fire_props_changed(uint64_t node_id, const char* adm_tags, const char* channel_id) {
|
||||
struct ms_props_cbk* pc = g_props_cbks;
|
||||
static void _fire_props_changed(struct UTUN_INSTANCE* inst, uint64_t node_id, const char* adm_tags, const char* channel_id) {
|
||||
if (!inst || !CC(inst)) return;
|
||||
struct ms_props_cbk* pc = CC(inst)->props_cbks;
|
||||
while (pc) { pc->fn(node_id, adm_tags, channel_id, pc->arg); pc = pc->next; }
|
||||
}
|
||||
|
||||
void member_sync_add_props_cbk(node_props_changed_fn fn, void* arg) {
|
||||
if (!fn) return;
|
||||
void member_sync_add_props_cbk(struct UTUN_INSTANCE* inst, node_props_changed_fn fn, void* arg) {
|
||||
if (!inst || !fn || !CC(inst)) return;
|
||||
struct ms_props_cbk* e = u_malloc(sizeof(*e));
|
||||
if (!e) return;
|
||||
e->fn = fn; e->arg = arg;
|
||||
e->next = g_props_cbks;
|
||||
g_props_cbks = e;
|
||||
e->next = CC(inst)->props_cbks;
|
||||
CC(inst)->props_cbks = e;
|
||||
}
|
||||
|
||||
void member_sync_remove_props_cbk(node_props_changed_fn fn, void* arg) {
|
||||
if (!fn) return;
|
||||
struct ms_props_cbk** p = &g_props_cbks;
|
||||
void member_sync_remove_props_cbk(struct UTUN_INSTANCE* inst, node_props_changed_fn fn, void* arg) {
|
||||
if (!inst || !fn || !CC(inst)) return;
|
||||
struct ms_props_cbk** p = &CC(inst)->props_cbks;
|
||||
while (*p) {
|
||||
if ((*p)->fn == fn && (*p)->arg == arg) {
|
||||
struct ms_props_cbk* r = *p;
|
||||
@@ -272,27 +272,27 @@ void member_sync_remove_props_cbk(node_props_changed_fn fn, void* arg) {
|
||||
/* ── Коллбэк применения рекорда мембера (ready-хендлинг join на connection-узле) ── */
|
||||
|
||||
struct ms_apply_cbk { member_apply_cbk_fn fn; void* arg; struct ms_apply_cbk* next; };
|
||||
static struct ms_apply_cbk* g_apply_cbks = NULL;
|
||||
|
||||
static void _fire_apply_cbk(const char* ch_id, uint64_t node_id,
|
||||
static void _fire_apply_cbk(struct UTUN_INSTANCE* inst, const char* ch_id, uint64_t node_id,
|
||||
const uint8_t* x25519, uint64_t signed_by,
|
||||
const uint8_t* signature) {
|
||||
struct ms_apply_cbk* ac = g_apply_cbks;
|
||||
if (!inst || !CC(inst)) return;
|
||||
struct ms_apply_cbk* ac = CC(inst)->apply_cbks;
|
||||
while (ac) { ac->fn(ch_id, node_id, x25519, signed_by, signature, ac->arg); ac = ac->next; }
|
||||
}
|
||||
|
||||
void member_sync_add_apply_cbk(member_apply_cbk_fn fn, void* arg) {
|
||||
if (!fn) return;
|
||||
void member_sync_add_apply_cbk(struct UTUN_INSTANCE* inst, member_apply_cbk_fn fn, void* arg) {
|
||||
if (!inst || !fn || !CC(inst)) return;
|
||||
struct ms_apply_cbk* e = u_malloc(sizeof(*e));
|
||||
if (!e) return;
|
||||
e->fn = fn; e->arg = arg;
|
||||
e->next = g_apply_cbks;
|
||||
g_apply_cbks = e;
|
||||
e->next = CC(inst)->apply_cbks;
|
||||
CC(inst)->apply_cbks = e;
|
||||
}
|
||||
|
||||
void member_sync_remove_apply_cbk(member_apply_cbk_fn fn, void* arg) {
|
||||
if (!fn) return;
|
||||
struct ms_apply_cbk** p = &g_apply_cbks;
|
||||
void member_sync_remove_apply_cbk(struct UTUN_INSTANCE* inst, member_apply_cbk_fn fn, void* arg) {
|
||||
if (!inst || !fn || !CC(inst)) return;
|
||||
struct ms_apply_cbk** p = &CC(inst)->apply_cbks;
|
||||
while (*p) {
|
||||
if ((*p)->fn == fn && (*p)->arg == arg) {
|
||||
struct ms_apply_cbk* r = *p;
|
||||
@@ -329,7 +329,7 @@ static void _ms_on_bgp_node(struct TOPO_GROUP* group, uint64_t node_id, int even
|
||||
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_MEMBER_SYNC, "%s: bgp_node ev=%d nid=0x%016llx tags=%s",
|
||||
MS_ID, event, (unsigned long long)node_id, tags);
|
||||
_fire_props_changed(node_id, tags[0] ? tags : NULL, group->channel_id);
|
||||
_fire_props_changed(inst, node_id, tags[0] ? tags : NULL, group->channel_id);
|
||||
}
|
||||
|
||||
static int _sig_is_zero64(const uint8_t* sig) {
|
||||
@@ -840,13 +840,9 @@ static int _member_apply_items(void* ctx, const char* ns, uint64_t from_peer,
|
||||
if (r & MS_APPLY_CHANGED) {
|
||||
changed_count++;
|
||||
/* fire node_props_changed callbacks */
|
||||
struct ms_props_cbk* pc = g_props_cbks;
|
||||
if (pc) {
|
||||
const char* tags_final = atags[0] ? atags : NULL;
|
||||
while (pc) { pc->fn(nid, tags_final, ns, pc->arg); pc = pc->next; }
|
||||
}
|
||||
_fire_props_changed(inst, nid, atags[0] ? atags : NULL, ns);
|
||||
/* fire apply callbacks (ready-хендлинг join на connection-узле) */
|
||||
_fire_apply_cbk(ns, nid, x25, sb, sgn);
|
||||
_fire_apply_cbk(inst, ns, nid, x25, sb, sgn);
|
||||
}
|
||||
if (r & MS_APPLY_STALE) {
|
||||
/* у нас версия новее — отправить наш полный рекорд автору */
|
||||
|
||||
Reference in new issue
Block a user