From 8a3cdaf7599ea63b1028dae0a471c41ffac9fbb5 Mon Sep 17 00:00:00 2001 From: jeka Date: Mon, 16 Feb 2026 23:42:28 +0300 Subject: [PATCH] 1 --- src/etcp_connections.c | 2 +- tests/test_debug.c | 54 ------------------------------------------ 2 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 tests/test_debug.c diff --git a/src/etcp_connections.c b/src/etcp_connections.c index b9c3f38..9e58859 100644 --- a/src/etcp_connections.c +++ b/src/etcp_connections.c @@ -592,7 +592,7 @@ int etcp_encrypt_send(struct ETCP_DGRAM* dgram) { int errcode=0; sc_context_t* sc = &dgram->link->etcp->crypto_ctx; int len=dgram->data_len-dgram->noencrypt_len;// не забываем добавить timestamp (2 bytes) - if (len<=0 || len>1480) { dgram->link->send_errors++; errcode=1; goto es_err; } + if (len<0 || len>1480) { dgram->link->send_errors++; errcode=1; goto es_err; } uint8_t enc_buf[1600]; size_t enc_buf_len=0; dgram->timestamp=get_current_timestamp(); diff --git a/tests/test_debug.c b/tests/test_debug.c deleted file mode 100644 index 5d8c48d..0000000 --- a/tests/test_debug.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "u_async.h" -#include -#include "../lib/debug_config.h" - -/* Test statistics */ -static struct { - int tests_run; - int tests_passed; - int tests_failed; - - /* Timer statistics */ - int timer_callbacks; - int timer_cancellations; - int immediate_timeouts; - - /* Socket statistics */ - int socket_events; - int socket_errors; - - /* Error statistics */ - int memory_allocation_errors; - int invalid_parameter_errors; - int race_condition_errors; -} test_stats = {0}; - -/* Timer callback for testing */ -static void test_timer_callback(void* arg) { - test_stats.timer_callbacks++; - DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "Timer callback fired. Total callbacks: %d", test_stats.timer_callbacks); -} - -int main() { - debug_config_init(); - debug_set_level(DEBUG_LEVEL_TRACE); - debug_set_categories(DEBUG_CATEGORY_ALL); - - DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "Before any tests: immediate_timeouts = %d", test_stats.immediate_timeouts); - - uasync_t* ua = uasync_create(); - - /* Set 5 immediate timeouts */ - for (int i = 0; i < 5; i++) { - void* timer = uasync_set_timeout(ua, 0, NULL, test_timer_callback); - } - - DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "After setting 5 immediate timeouts, before poll: immediate_timeouts = %d", test_stats.immediate_timeouts); - - uasync_poll(ua, 1); - - DEBUG_INFO(DEBUG_CATEGORY_UASYNC, "After poll: immediate_timeouts = %d", test_stats.immediate_timeouts); - - uasync_destroy(ua, 0); - return 0; -}