fix: etcp_conn_reset resume output_queue+ack_q+normalizer; collision client-timer cancel; ETCP full state dump to debug log on sync TIMEOUT

This commit is contained in:
evgeny committed 2026-07-30 09:17:28 +03:00
1 parent a3b00984ed
commit 6f502243db
5 files changed
+151 -174

No files matched your search

+15 -4
View File
@@ -6,6 +6,7 @@
#include "../utun_instance.h"
#include "../routing_layer/topo_group.h"
#include "../routing_layer/topo_node_sqlite.h"
#include "../transport_layer/etcp_dump.h"
#include "../transport_layer/secure_channel.h"
#include "../../lib/debug_config.h"
#include "../../lib/mem.h"
@@ -541,12 +542,16 @@ static int db_sync_send_hash(struct DB_SYNC* db, uint64_t node_id, uint64_t hash
struct ETCP_CONN* conn = instance_find_conn(db->inst, node_id);
if (!conn || !conn->links_up) {
DEBUG_WARN(DEBUG_CATEGORY_DB_SYNC, "sync: send DROP — no direct conn to %04llX (hash=%016llx, type=%02x)",
(unsigned long long)(node_id >> 16), hash, plen > 0 ? payload[0] : 0);
DEBUG_WARN(DEBUG_CATEGORY_DB_SYNC, "sync: send DROP — no direct conn to %04llX (hash=%016llx, type=%02x, conn=%p lu=%d)",
(unsigned long long)(node_id >> 16), hash, plen > 0 ? payload[0] : 0,
(void*)conn, conn ? conn->links_up : -1);
queue_entry_free(entry);
return -1;
}
return etcp_send(conn, entry);
int ret = etcp_send(conn, entry);
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "sync: send OK → etcp_send ret=%d conn=%s l_up=%d init=%d q=%p",
ret, conn->log_name, conn->links_up, conn->initialized, (void*)conn->send_input_q);
return ret;
}
static int db_sync_send(struct DB_SYNC_INSTANCE* si, uint64_t dst_node_id, const uint8_t* payload, size_t len)
@@ -653,7 +658,10 @@ static void db_handle_init_sync(struct DB_SYNC_INSTANCE* si, uint64_t src, const
scnt++;
}
resp[sp] = (uint8_t)scnt;
db_sync_send(si, src, resp, off);
int sret = db_sync_send(si, src, resp, off);
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "sync [%s:%04llX] → INIT_RESP: sent %u bytes to peer=%016llx ret=%d flow=%u,%u",
SI_SHRT(si), (unsigned long long)(src >> 16), off, (unsigned long long)src, sret,
resp[0], resp[1]);
}
static void db_handle_init_resp(struct DB_SYNC_INSTANCE* si, uint64_t src, const uint8_t* p, size_t len)
@@ -1517,6 +1525,9 @@ static void db_sync_peer_check_cb(void* arg)
SI_SHRT(si), (unsigned long long)(p->node_id >> 16),
(unsigned long long)((now - p->sync_start_tb) / 10), p->synced_pos);
p->sync_state = 0;
static int dump_ctr = 0;
if (dump_ctr++ == 0 || (dump_ctr % 10) == 0)
etcp_dump_all(db->inst);
}
}
}