Keep local CM demand after stale control and reject zero requests

This commit is contained in:
evgeny committed 2026-10-24 16:22:15 +02:00
1 parent 182fb97970
commit 00a85a1468
2 files changed
+16 -3

No files matched your search

+13 -2
View File
@@ -178,14 +178,25 @@ static void test3_verify(void* arg) {
#ifdef __linux__
if (rejected_soon) { fail("test4: cleanup attempted to allocate call_soon"); return; }
#endif
fprintf(stderr, "Test 5: remote cleanup detaches handles and cancels pending UP\n");
fprintf(stderr, "Test 5: obsolete DISCONNECT preserves demand; local cleanup detaches handles\n");
if (conn_mgr_open(g_a, TOPO_GROUP_UTUN, g_nid_b, ccb1, NULL, &gh1) != 0) {
fail("test5: open failed"); return;
}
cb1_ok = 0;
conn_mgr_routes_changed(mgr);
if (!gh1->entry->refresh_token) { fail("test5: refresh not scheduled"); return; }
cm_handle_disconnect(mgr, g_nid_b);
struct CONN_MGR_ENTRY* attached = gh1->entry;
struct ll_entry* obsolete = ll_alloc_lldgram(ROUTER_SVC_HDR_SIZE + 10);
if (!obsolete) { fail("test5: packet allocation failed"); return; }
memset(obsolete->dgram, 0, ROUTER_SVC_HDR_SIZE + 10); obsolete->len = ROUTER_SVC_HDR_SIZE + 10;
memcpy(obsolete->dgram + ROUTER_SVC_GROUP_OFF, &mgr->group->group_id, 8);
memcpy(obsolete->dgram + ROUTER_SVC_SRC_OFF, &g_nid_b, 8);
obsolete->dgram[ROUTER_SVC_PAYLOAD_OFF] = ETCP_RT_ID_CONN_MGR;
obsolete->dgram[ROUTER_SVC_PAYLOAD_OFF + 1] = 0x06;
memcpy(obsolete->dgram + ROUTER_SVC_PAYLOAD_OFF + 2, &g_nid_b, 8);
conn_mgr_router_recv_handler(instance_find_conn(g_a, g_nid_b), obsolete);
if (gh1->entry != attached) { fail("test5: remote packet detached local demand"); return; }
cm_entry_cleanup(attached);
if (gh1->entry || gh1->deliver_up_token || conn_mgr_get_conn(gh1)) { fail("test5: handle not detached"); return; }
conn_mgr_close(gh1); gh1 = NULL;
uasync_poll(ua, 0);