From f3d03c6e7dbffc2ad2562536d789a3691ed90d83 Mon Sep 17 00:00:00 2001 From: JeffMboya Date: Wed, 15 Jan 2025 18:26:05 +0300 Subject: [PATCH] Remove binary chunk assembly logic --- embed-proplet/src/wasm_handler.c | 22 ---------------------- embed-proplet/src/wasm_handler.h | 8 -------- 2 files changed, 30 deletions(-) diff --git a/embed-proplet/src/wasm_handler.c b/embed-proplet/src/wasm_handler.c index 680a4fe..9d628d4 100644 --- a/embed-proplet/src/wasm_handler.c +++ b/embed-proplet/src/wasm_handler.c @@ -4,27 +4,6 @@ LOG_MODULE_REGISTER(wasm_handler); -static uint8_t wasm_file_buffer[8192]; -static size_t wasm_file_offset = 0; - -void handle_wasm_chunk(const uint8_t *data, size_t len) -{ - if (wasm_file_offset + len > sizeof(wasm_file_buffer)) { - LOG_ERR("Wasm file too large to fit in buffer."); - wasm_file_offset = 0; - return; - } - - memcpy(&wasm_file_buffer[wasm_file_offset], data, len); - wasm_file_offset += len; - - if (data[len - 1] == '\0') { - LOG_INF("All Wasm chunks received. Total size: %zu bytes. Executing Wasm file...", wasm_file_offset); - execute_wasm_from_memory(wasm_file_buffer, wasm_file_offset); - wasm_file_offset = 0; - } -} - void execute_wasm_from_memory(const uint8_t *wasm_data, size_t wasm_size) { RuntimeInitArgs init_args = { .mem_alloc_type = Alloc_With_System_Allocator }; @@ -61,7 +40,6 @@ void execute_wasm_from_memory(const uint8_t *wasm_data, size_t wasm_size) LOG_ERR("Function 'main' not found in Wasm module."); } - wasm_runtime_deinstantiate(module_inst); wasm_runtime_unload(module); wasm_runtime_destroy(); diff --git a/embed-proplet/src/wasm_handler.h b/embed-proplet/src/wasm_handler.h index 878f694..21020c4 100644 --- a/embed-proplet/src/wasm_handler.h +++ b/embed-proplet/src/wasm_handler.h @@ -3,14 +3,6 @@ #include -/** - * Handle a chunk of incoming Wasm file data. - * - * @param data Pointer to the data chunk. - * @param len Length of the data chunk. - */ -void handle_wasm_chunk(const uint8_t *data, size_t len); - /** * Execute a Wasm application from the provided memory buffer. *