Replace printf with DEBUG_ macros in simple_test.c, test_packet_dump.c, test_intensive_memory_pool.c
This commit is contained in:
1 parent
a90b3038ac
commit
0d75546ff0
3 files changed
+35
-22
No files matched your search
+12
-7
@@ -1,4 +1,5 @@
|
||||
#include "../lib/u_async.h"
|
||||
#include "../lib/debug_config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -10,25 +11,29 @@ static void test_callback(int fd, void* arg) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
debug_config_init();
|
||||
debug_set_level(DEBUG_LEVEL_TRACE);
|
||||
debug_set_categories(DEBUG_CATEGORY_ALL);
|
||||
|
||||
uasync_t* ua = uasync_create();
|
||||
if (!ua) return 1;
|
||||
|
||||
printf("=== Simple Corruption Test ===\n");
|
||||
DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "=== Simple Corruption Test ===");
|
||||
|
||||
// Create just one socket
|
||||
int sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
printf("Created socket with fd=%d\n", sock);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "Created socket with fd=%d", sock);
|
||||
|
||||
void* id = uasync_add_socket(ua, sock, test_callback, NULL, NULL, NULL);
|
||||
printf("Added socket: fd=%d, id=%p\n", sock, id);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "Added socket: fd=%d, id=%p", 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);
|
||||
// Check if fd is still correct (internal struct socket_node not exposed)
|
||||
// struct socket_node* node = (struct socket_node*)id;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "Node fd after add: %d", sock);
|
||||
|
||||
// Try to remove immediately (no polling)
|
||||
int result = uasync_remove_socket(ua, id);
|
||||
printf("Remove result: %d\n", result);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "Remove result: %d", result);
|
||||
|
||||
close(sock);
|
||||
uasync_destroy(ua, 0);
|
||||
|
||||
Reference in new issue
Block a user