Browse Source

fix chatgui: prevent invite deadlock on connection flap

cs_on_conn_down: remove invite state zeroing on disconnection.
Only timeout callbacks and explicit protocol end (CS_MSG_ERROR,
transition to JOIN phase) clear the invite state.

Connection flap now causes automatic retry:
  conn_up → pending_invite_ch_id != 0 && !info_req_timer → resend
  CHANNEL_INFO_REQ. No deadlock possible.
topo_upd
Evgeny 3 months ago
parent
commit
58b9f28149
  1. 3
      AGENTS.md
  2. 6
      tools/chatgui/transport/chat_sync.c

3
AGENTS.md

@ -12,6 +12,9 @@ This file contains essential information for AI coding agents working in the uTu
Это devel. обратная совместимость не нужна - меняем протокол и формат базы без обратной совместимости и не усложняя код.
Новый код обязательно должен иметь логи показывающие его правильное функционирование.
Все ошибки и нештатное поведение должно логироваться
## Quick Reference
**Repository:** uTun - Secure VPN tunnel with ETCP protocol

6
tools/chatgui/transport/chat_sync.c

@ -461,9 +461,9 @@ static void cs_on_conn_down(struct ETCP_CONN* conn, void* arg) {
uint64_t peer = conn->peer_node_id;
cs_cancel_proto_timers(g_cs);
if (g_cs->pending_invite_node_id == peer) {
DEBUG_WARN(DEBUG_CATEGORY_CONNECTIVITY, "%s: conn down while waiting invite resp peer=%016llx", CS_ID, (unsigned long long)peer);
g_cs->pending_invite_node_id = 0;
g_cs->pending_invite_ch_id = 0;
DEBUG_WARN(DEBUG_CATEGORY_CONNECTIVITY, "%s: conn down while waiting invite resp peer=%016llx, timers cancelled, state kept for retry on reconnect",
CS_ID, (unsigned long long)peer);
/* invite state survives connection flaps: only timeout or explicit protocol end clears it */
}
for (int i = 0; i < g_cs->channel_count; i++) {
int found = 0;

Loading…
Cancel
Save