Name inviter confirmation callback for success and rejection
This commit is contained in:
1 parent
cb9036d54c
commit
dbe639ff55
3 files changed
+5
-5
No files matched your search
@@ -374,7 +374,7 @@ static void join_recv_cb(struct ETCP_CONN* conn, struct ll_entry* entry) {
|
||||
uint64_t attempt, node; int32_t result;
|
||||
memcpy(&attempt, payload + 1, 8); memcpy(&node, payload + 9, 8); memcpy(&result, payload + 17, 4);
|
||||
if (!result || result == CHAT_CONNECT_AUTH || result == CHAT_CONNECT_ERROR)
|
||||
chat_sync_join_rejected(inst, group_id, from_node, attempt, node, result);
|
||||
chat_sync_join_inviter_result(inst, group_id, from_node, attempt, node, result);
|
||||
} else {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_CHAT_SYNC, "%s: unknown subcmd=%02x from=%016llx", CJ_ID, subcmd, (unsigned long long)from_node);
|
||||
}
|
||||
|
||||
@@ -1626,7 +1626,7 @@ static void cs_send_join_ready(struct chat_sync* cs, const char* ch_id, uint64_t
|
||||
if (sent) cs_schedule_sync(cs, group, node_id, "join_accepted");
|
||||
}
|
||||
|
||||
void chat_sync_join_rejected(struct UTUN_INSTANCE* inst, uint64_t channel, uint64_t inviter,
|
||||
void chat_sync_join_inviter_result(struct UTUN_INSTANCE* inst, uint64_t channel, uint64_t inviter,
|
||||
uint64_t attempt, uint64_t node, int result) {
|
||||
struct chat_sync* cs = cs_of(inst);
|
||||
if (!cs || !cs->initialized) return;
|
||||
@@ -1702,7 +1702,7 @@ static void cs_handle_join_request(struct chat_sync* cs, uint64_t peer,
|
||||
/* форвард инвайтеру (или локальная обработка, если инвайтер == мы) */
|
||||
if (inviter == cs->inst->node_id) {
|
||||
int result = chat_join_process_request(cs->inst, channel_id, peer, join_key, member_data, member_len);
|
||||
chat_sync_join_rejected(cs->inst, channel_id, inviter, attempt, m.node_id, result);
|
||||
chat_sync_join_inviter_result(cs->inst, channel_id, inviter, attempt, m.node_id, result);
|
||||
/* мы и есть connection-узел + инвайтер: рекорд добавлен локально,
|
||||
merkle-apply-коллбэк (cs_on_member_applied) здесь не сработает —
|
||||
отправляем JOIN_READY напрямую, если мембер реально добавлен. */
|
||||
@@ -1714,7 +1714,7 @@ static void cs_handle_join_request(struct chat_sync* cs, uint64_t peer,
|
||||
}
|
||||
} else {
|
||||
if (chat_join_forward_request(cs->inst, channel_id, inviter, join_key, attempt, &m) < 0)
|
||||
chat_sync_join_rejected(cs->inst, channel_id, inviter, attempt, m.node_id, CHAT_CONNECT_ERROR);
|
||||
chat_sync_join_inviter_result(cs->inst, channel_id, inviter, attempt, m.node_id, CHAT_CONNECT_ERROR);
|
||||
}
|
||||
|
||||
cs_refresh_channels(cs);
|
||||
|
||||
@@ -101,7 +101,7 @@ int chat_sync_join_link(struct UTUN_INSTANCE* inst, uint64_t request, const char
|
||||
/* Единый формат результата: peer:8,result:4,channel:8,request:8, native; только uasync. */
|
||||
void chat_sync_join_result(struct UTUN_INSTANCE* inst, uint64_t request, uint64_t channel, uint64_t peer, int result);
|
||||
/* Подписанный ответ инвайтера на forwarded JOIN. Проверяет inviter, attempt и node ожидающего запроса. */
|
||||
void chat_sync_join_rejected(struct UTUN_INSTANCE* inst, uint64_t channel, uint64_t inviter,
|
||||
void chat_sync_join_inviter_result(struct UTUN_INSTANCE* inst, uint64_t channel, uint64_t inviter,
|
||||
uint64_t attempt, uint64_t node, int result);
|
||||
|
||||
/* uasync: пригласить адресата в свой channel. SERVER-ссылка запускает запрос с add_key и обычным
|
||||
|
||||
Reference in new issue
Block a user