|
|
|
|
@ -1511,31 +1511,6 @@ void uasync_destroy(struct UASYNC* ua, int close_fds) {
|
|
|
|
|
socket_platform_cleanup(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void uasync_init_instance(struct UASYNC* ua) { |
|
|
|
|
if (!ua) return; |
|
|
|
|
|
|
|
|
|
// Initialize socket array if not present
|
|
|
|
|
if (!ua->sockets) { |
|
|
|
|
ua->sockets = socket_array_create(16); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!ua->timeout_pool) { |
|
|
|
|
ua->timeout_pool = memory_pool_init(sizeof(struct timeout_node)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!ua->immediate_queue_head) { |
|
|
|
|
ua->immediate_queue_head = NULL; |
|
|
|
|
ua->immediate_queue_tail = NULL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!ua->timeout_heap) { |
|
|
|
|
ua->timeout_heap = timeout_heap_create(16); |
|
|
|
|
if (ua->timeout_heap) { |
|
|
|
|
timeout_heap_set_free_callback(ua->timeout_heap, ua, timeout_node_free_callback); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Debug statistics
|
|
|
|
|
void uasync_get_stats(struct UASYNC* ua, size_t* timer_alloc, size_t* timer_u_free, size_t* socket_alloc, size_t* socket_u_free) { |
|
|
|
|
if (!ua) return; |
|
|
|
|
|