#include "../lib/u_async.h" #include #include #include #include #include static void test_callback(int fd, void* arg) { (void)fd; (void)arg; } int main() { uasync_t* ua = uasync_create(); if (!ua) return 1; printf("=== Simple Corruption Test ===\n"); // Create just one socket int sock = socket(AF_INET, SOCK_DGRAM, 0); printf("Created socket with fd=%d\n", sock); void* id = uasync_add_socket(ua, sock, test_callback, NULL, NULL, NULL); printf("Added socket: fd=%d, id=%p\n", sock, id); // Check if fd is still correct struct socket_node* node = (struct socket_node*)id; printf("Node fd after add: %d\n", node->fd); // Try to remove immediately (no polling) int result = uasync_remove_socket(ua, id); printf("Remove result: %d\n", result); close(sock); uasync_destroy(ua, 0); return 0; }