This commit is contained in:
evgeny committed 2026-08-07 12:21:41 +03:00
1 parent 38c9f229bc
commit fd00e5dd15
290 files changed
+91612 -34

No files matched your search

+2 -5
View File
@@ -133,7 +133,7 @@ static void topo_group_broadcast_withdraw(struct TOPO_GROUP* group, uint64_t nod
struct TOPO_GROUP_CONN_ITEM* item = (struct TOPO_GROUP_CONN_ITEM*)e->data;
if (item && item->conn && item->conn != exclude) {
struct ll_entry* copy = queue_entry_new(0);
if (copy) { copy->dgram = u_malloc(sizeof(*pkt)); if (copy->dgram) memcpy(copy->dgram, pkt, sizeof(*pkt)); copy->len = sizeof(*pkt); etcp_send(item->conn, copy); }
if (copy) { copy->dgram = u_malloc(sizeof(*pkt)); if (copy->dgram) { memcpy(copy->dgram, pkt, sizeof(*pkt)); copy->len = sizeof(*pkt); if (etcp_send(item->conn, copy) != 0) { u_free(copy->dgram); queue_entry_free(copy); } } else { queue_entry_free(copy); } }
}
e = e->next;
}
@@ -201,10 +201,7 @@ static void topo_group_conn_status(struct ETCP_CONN* conn, int status, void* arg
while (fe) { struct TOPO_GROUP* g = (struct TOPO_GROUP*)fe; fe = fe->next;
if (status == ETCP_CONN_STATUS_UP) topo_group_new_conn(g, conn);
if (status == ETCP_CONN_STATUS_DOWN) topo_group_remove_conn(g, conn);
if (status == ETCP_CONN_STATUS_DELETE) {
struct TOPO_GROUP_NODE* nq = topo_node_find_by_id(g, conn->peer_node_id);
if (nq) { nq->conn_presence &= ~NCONN_DIRECT; nq->conn_up &= ~NCONN_DIRECT; }
}
if (status == ETCP_CONN_STATUS_DELETE) topo_group_remove_conn(g, conn);
}
}
+3 -2
View File
@@ -404,7 +404,8 @@ void etcp_connection_close(struct ETCP_CONN* etcp) {
// === PHASE 1: detach from external world ===
if (etcp->links_up != 0) { etcp->links_up = 0; etcp_on_down(etcp, NULL); }
if (etcp->links_up != 0) etcp->links_up = 0;
etcp_cbk_fire(etcp, ETCP_CBK_EVENT_DOWN);
// Cancel active timers
if (etcp->retrans_timer) { uasync_cancel_timeout(etcp->instance->ua, etcp->retrans_timer); etcp->retrans_timer = NULL; }
@@ -414,7 +415,7 @@ void etcp_connection_close(struct ETCP_CONN* etcp) {
routing_del_conn(etcp);
etcp_router_transit_queues_destroy(etcp);
if (etcp->normalizer) { pn_deinit((struct PKTNORM*)etcp->normalizer); etcp->normalizer = NULL; }
if (etcp->normalizer) { pn_deinit((struct PKTNORM*)etcp->normalizer); etcp->normalizer = NULL; etcp->send_input_q = NULL; }
// Close links (detach from socket scan queues)
if (etcp->links) {
+1 -1
View File
@@ -168,7 +168,7 @@ int etcp_unbind(struct UTUN_INSTANCE* inst, uint8_t id) {
}
int etcp_send(struct ETCP_CONN* conn, struct ll_entry* entry) {
if (!conn || !entry || !conn->send_input_q) return -1;
if (!conn || !entry || !conn->send_input_q || conn->state == 2) return -1;
return queue_data_put(conn->send_input_q, entry);
}
+3 -1
View File
@@ -1000,7 +1000,7 @@ void etcp_link_close(struct ETCP_LINK* link) {
if (link->is_tcp) {
if (link->tcp_reconnect_timer) { uasync_cancel_timeout(link->etcp->instance->ua, link->tcp_reconnect_timer); link->tcp_reconnect_timer = NULL; }
if (link->tcp_link) { stcp_link_close(link->tcp_link); link->tcp_link = NULL; }
if (link->tcp_link) { stcp_link_set_on_close(link->tcp_link, NULL, NULL); stcp_link_close(link->tcp_link); link->tcp_link = NULL; }
}
if (link->burst_resp_timer) {
@@ -1108,6 +1108,7 @@ void etcp_tcp_link_start_connect(struct ETCP_LINK *link, struct sockaddr_storage
void etcp_tcp_link_start_reconnect(struct ETCP_LINK *link) {
if (!link || !link->etcp || !link->etcp->instance || link->is_server) return;
if (link->etcp->state == 2) return;
if (link->tcp_reconnect_timer) return;
if (link->tcp_link) { stcp_link_close(link->tcp_link); link->tcp_link = NULL; }
link->link_state = 1;
@@ -1118,6 +1119,7 @@ void etcp_tcp_link_start_reconnect(struct ETCP_LINK *link) {
static void tcp_link_close_cb(struct stcp_link *sl, int err, void *arg) {
struct ETCP_LINK *link = (struct ETCP_LINK *)arg;
if (!link || !link->etcp) return;
if (link->etcp->state == 2) return;
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "[%s] TCP link %d down err=%d, scheduling reconnect", link->etcp->log_name, link->local_link_id, err);
link->tcp_link = NULL;
etcp_tcp_link_start_reconnect(link);