From 1f818947b90fc835fcb0f8d159b4f795f681aff4 Mon Sep 17 00:00:00 2001 From: dianjixz Date: Wed, 11 Sep 2024 15:30:18 +0800 Subject: [PATCH] [remove] nng lib && nng_demo, experienced a serious memory leak. --- components/nng/Kconfig | 10 ---- components/nng/SConstruct | 17 ------ examples/nng_demo/.gitignore | 6 -- examples/nng_demo/README.md | 7 --- examples/nng_demo/SConstruct | 4 -- examples/nng_demo/config_defaults.mk | 3 - examples/nng_demo/main/Kconfig | 0 examples/nng_demo/main/SConstruct | 45 -------------- examples/nng_demo/main/include/main.h | 0 .../main/src/test_xreq_recv_garbage.c | 58 ------------------- github_source/source-list.sh | 1 - 11 files changed, 151 deletions(-) delete mode 100644 components/nng/Kconfig delete mode 100644 components/nng/SConstruct delete mode 100644 examples/nng_demo/.gitignore delete mode 100644 examples/nng_demo/README.md delete mode 100644 examples/nng_demo/SConstruct delete mode 100644 examples/nng_demo/config_defaults.mk delete mode 100644 examples/nng_demo/main/Kconfig delete mode 100644 examples/nng_demo/main/SConstruct delete mode 100644 examples/nng_demo/main/include/main.h delete mode 100644 examples/nng_demo/main/src/test_xreq_recv_garbage.c diff --git a/components/nng/Kconfig b/components/nng/Kconfig deleted file mode 100644 index 2f569c9..0000000 --- a/components/nng/Kconfig +++ /dev/null @@ -1,10 +0,0 @@ - -menuconfig NNG_ENABLED - bool "Enable nng" - default n - - config NNG_DYNAMIC - bool "compile component as dynamic(shared) lib" - default n - depends on NNG_ENABLED - diff --git a/components/nng/SConstruct b/components/nng/SConstruct deleted file mode 100644 index a3f9535..0000000 --- a/components/nng/SConstruct +++ /dev/null @@ -1,17 +0,0 @@ -# component/SConscript -Import("env") -import os - -with open(env["PROJECT_TOOL_S"]) as f: - exec(f.read()) - - -if "CONFIG_NNG_ENABLED" in os.environ: - check_component('nng') - ext_compile_script = str(AFile("../../github_source/component_configs/{}-nng-{}-SConstruct.py".format(env['GCC_DUMPMACHINE'], env['GIT_REPO_LISTS']['nng']['commit']))) - if not os.path.exists(ext_compile_script): - ext_compile_script = str(AFile("../../github_source/component_configs/gcc-nng-{}-SConstruct.py".format(env['GIT_REPO_LISTS']['nng']['commit']))) - - if os.path.exists(ext_compile_script): - with open(ext_compile_script) as f: - exec(f.read()) diff --git a/examples/nng_demo/.gitignore b/examples/nng_demo/.gitignore deleted file mode 100644 index 76b743d..0000000 --- a/examples/nng_demo/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ - -dist -build -.config.mk -.flash.conf.json - diff --git a/examples/nng_demo/README.md b/examples/nng_demo/README.md deleted file mode 100644 index 1d674cc..0000000 --- a/examples/nng_demo/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# [libhv](https://github.com/ithewei/libhv) - -Like `libevent, libev, and libuv`, -`libhv` provides event-loop with non-blocking IO and timer, -but simpler api and richer protocols. - -[README](https://github.com/ithewei/libhv/blob/master/README.md) \ No newline at end of file diff --git a/examples/nng_demo/SConstruct b/examples/nng_demo/SConstruct deleted file mode 100644 index 076d65c..0000000 --- a/examples/nng_demo/SConstruct +++ /dev/null @@ -1,4 +0,0 @@ -from pathlib import Path -import os -with open(str(Path(os.getcwd())/'..'/'..'/'tools'/'scons'/'project.py')) as f: - exec(f.read()) diff --git a/examples/nng_demo/config_defaults.mk b/examples/nng_demo/config_defaults.mk deleted file mode 100644 index f5f814f..0000000 --- a/examples/nng_demo/config_defaults.mk +++ /dev/null @@ -1,3 +0,0 @@ -# CONFIG_TOOLCHAIN_PATH="/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin" -# CONFIG_TOOLCHAIN_PREFIX="arm-linux-gnueabihf-" -CONFIG_NNG_ENABLED=y diff --git a/examples/nng_demo/main/Kconfig b/examples/nng_demo/main/Kconfig deleted file mode 100644 index e69de29..0000000 diff --git a/examples/nng_demo/main/SConstruct b/examples/nng_demo/main/SConstruct deleted file mode 100644 index b1b3c1f..0000000 --- a/examples/nng_demo/main/SConstruct +++ /dev/null @@ -1,45 +0,0 @@ -# project_root/src/SConscript -import os -# Import the environment from the SConstruct file -Import('env') -with open(env['PROJECT_TOOL_S']) as f: - exec(f.read()) - -SRCS = [] -INCLUDE = [ADir('include'), ADir('.')] -PRIVATE_INCLUDE = [] -REQUIREMENTS = ['nng', 'pthread'] -STATIC_LIB = [] -DYNAMIC_LIB = [] -DEFINITIONS = [] -DEFINITIONS_PRIVATE = [] -LDFLAGS = [] -LINK_SEARCH_PATH = [] - -INCLUDE += [ADir('../../../github_source/nng/src')] - - -LDFLAGS += ['-Wl,-rpath=./'] - -all_src_files = Glob('src/*.c*') - -for src in all_src_files: - SRCS = [src] - if str(src).endswith('.cpp'): - target_name = os.path.basename(str(src)[:-4]) - elif str(src).endswith('.c'): - target_name = os.path.basename(str(src)[:-2]) - - env['COMPONENTS'].append({'target':target_name, - 'SRCS':SRCS, - 'INCLUDE':INCLUDE, - 'PRIVATE_INCLUDE':PRIVATE_INCLUDE, - 'REQUIREMENTS':REQUIREMENTS, - 'STATIC_LIB':STATIC_LIB, - 'DYNAMIC_LIB':DYNAMIC_LIB, - 'DEFINITIONS':DEFINITIONS, - 'DEFINITIONS_PRIVATE':DEFINITIONS_PRIVATE, - 'LDFLAGS':LDFLAGS, - 'LINK_SEARCH_PATH':LINK_SEARCH_PATH, - 'REGISTER':'project' - }) \ No newline at end of file diff --git a/examples/nng_demo/main/include/main.h b/examples/nng_demo/main/include/main.h deleted file mode 100644 index e69de29..0000000 diff --git a/examples/nng_demo/main/src/test_xreq_recv_garbage.c b/examples/nng_demo/main/src/test_xreq_recv_garbage.c deleted file mode 100644 index a50bb65..0000000 --- a/examples/nng_demo/main/src/test_xreq_recv_garbage.c +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include -#include -#include -// #include - - - - -int main(int argc, char *argv[]) -{ - nng_socket rep; - nng_socket req; - nng_msg * m; - uint32_t req_id; - - nng_rep0_open_raw(&rep); - nng_req0_open_raw(&req); - nng_socket_set_ms(req, NNG_OPT_RECVTIMEO, 100); - nng_socket_set_ms(req, NNG_OPT_SENDTIMEO, 1000); - nng_socket_set_ms(rep, NNG_OPT_SENDTIMEO, 1000); - nng_socket_set_ms(rep, NNG_OPT_SENDTIMEO, 1000); - - - nuts_marry(req, rep); - - nng_msg_alloc(&m, 0); - nng_msg_append_u32(m, 0x80000000); - nng_sendmsg(req, m, 0); - - - printf("nng_msg_header_len:%ld\n", nng_msg_header_len(m)); - - nng_recvmsg(rep, &m, 0); - - // // The message will have a header that contains the 32-bit pipe ID, - // // followed by the 32-bit request ID. We will discard the request - // // ID before sending it out. - - printf("nng_msg_header_len:%ld\n", nng_msg_header_len(m)); - - - - nng_msg_header_chop_u32(m, &req_id); - - - nng_sendmsg(rep, m, 0); - nng_recvmsg(req, &m, 0), NNG_ETIMEDOUT; - - nng_close(req); - nng_close(rep); - - - - - return 0; -} \ No newline at end of file diff --git a/github_source/source-list.sh b/github_source/source-list.sh index fb47014..72dc1f1 100755 --- a/github_source/source-list.sh +++ b/github_source/source-list.sh @@ -22,7 +22,6 @@ git_clone_and_checkout_commit https://github.com/dianjixz/gear-lib.git cf68 git_clone_and_checkout_commit https://github.com/dianjixz/stb.git 3b31d1d0a3fd0e563fd5cfaabf67c9921a08bb61 git_clone_and_checkout_commit https://github.com/dianjixz/libs.git a6456b8e7f1564b0c94c329509fe9652bb5a096b git_clone_and_checkout_commit https://github.com/dianjixz/nanomsg.git 2d01e935e4554580da4e9dbd94964af94e0ded9c -git_clone_and_checkout_commit https://github.com/nanomsg/nng.git a8a8bd435690e24e55dcdad485e97225902cb0c8 # cd lvgl && git_clone_and_checkout_commit https://github.com/dianjixz/lvgl.git 5cdf242a21a0897ee1f24b85040d2993a817b822 # cd lvgl && git_clone_and_checkout_commit https://github.com/lvgl/lv_drivers.git 820341ea15d0e9f0faaf0b508ba03c3ef9cb1a88 git_clone_and_checkout_commit https://github.com/dianjixz/toolkit.git 64120e079446c77990d892865fa5a105fc46036f