Skip to content

Commit b67b561

Browse files
jturnsekxiaoxiang781216
authored andcommitted
Using poll instead of epoll by default
1 parent 699b7c6 commit b67b561

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

netutils/nng/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,25 @@ config NETUTILS_NNG_VERSION
1717
string "NNG Version"
1818
default "1.5.2"
1919

20+
config NETUTILS_NNG_HAVE_EPOLL
21+
bool "Build with epoll"
22+
default n
23+
---help---
24+
If this option is selected, an epoll based poll gueue
25+
is included in the build. Otherwise poll based queue
26+
is included in the build.
27+
28+
choice
29+
prompt "TLS engine"
30+
default NETUTILS_NNG_USE_NONE
31+
32+
config NETUTILS_NNG_USE_NONE
33+
bool "None"
34+
35+
config NETUTILS_NNG_USE_MBEDTLS
36+
bool "MbedTLS"
37+
select CRYPTO_MBEDTLS
38+
39+
endchoice # TLS engine
40+
2041
endif

netutils/nng/Makefile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,20 @@ CFLAGS += -DNNG_TRANSPORT_WS
3636
CFLAGS += -DNNG_TRANSPORT_WSS
3737

3838
CFLAGS += -DNNG_USE_EVENTFD
39+
ifeq ($(CONFIG_NETUTILS_NNG_HAVE_EPOLL),y)
3940
CFLAGS += -DNNG_HAVE_EPOLL
4041
CFLAGS += -DNNG_HAVE_EPOLL_CREATE1
42+
endif
43+
44+
ifeq ($(CONFIG_NETUTILS_NNG_USE_MBEDTLS),y)
45+
CFLAGS += -DNNG_TLS_ENGINE_INIT=nng_tls_engine_init_mbed
46+
CFLAGS += -DNNG_TLS_ENGINE_FINI=nng_tls_engine_fini_mbed
47+
CFLAGS += -DNNG_SUPP_TLS
48+
endif
4149

4250
DEPPATH += --dep-path $(NNG_SRCDIR)
4351
VPATH += :$(NNG_SRCDIR)
4452

45-
4653
CSRCS = $(NNG_SRCDIR)/nng.c
4754
CSRCS += $(NNG_SRCDIR)/nng_legacy.c
4855
CSRCS += $(NNG_SRCDIR)/core/aio.c
@@ -88,9 +95,12 @@ CSRCS += $(NNG_SRCDIR)/platform/posix/posix_tcpdial.c
8895
CSRCS += $(NNG_SRCDIR)/platform/posix/posix_tcplisten.c
8996
CSRCS += $(NNG_SRCDIR)/platform/posix/posix_thread.c
9097
CSRCS += $(NNG_SRCDIR)/platform/posix/posix_udp.c
98+
ifeq ($(CONFIG_NETUTILS_NNG_HAVE_EPOLL),y)
9199
CSRCS += $(NNG_SRCDIR)/platform/posix/posix_pollq_epoll.c
100+
else
101+
CSRCS += $(NNG_SRCDIR)/platform/posix/posix_pollq_poll.c
102+
endif
92103
CSRCS += $(NNG_SRCDIR)/platform/posix/posix_rand_getrandom.c
93-
#CSRCS += $(NNG_SRCDIR)/platform/posix/posix_rand_urandom.c
94104

95105
CSRCS += $(NNG_SRCDIR)/sp/transport.c
96106
CSRCS += $(NNG_SRCDIR)/sp/protocol/bus0/bus.c
@@ -126,8 +136,9 @@ CSRCS += $(NNG_SRCDIR)/supplemental/http/http_schemes.c
126136
CSRCS += $(NNG_SRCDIR)/supplemental/http/http_server.c
127137
CSRCS += $(NNG_SRCDIR)/supplemental/sha1/sha1.c
128138
CSRCS += $(NNG_SRCDIR)/supplemental/tls/tls_common.c
129-
#CSRCS += $(NNG_SRCDIR)/supplemental/tls/mbedtls/tls.c
130-
#CSRCS += $(NNG_SRCDIR)/supplemental/util/options.c
139+
ifeq ($(CONFIG_NETUTILS_NNG_USE_MBEDTLS),y)
140+
CSRCS += $(NNG_SRCDIR)/supplemental/tls/mbedtls/tls.c
141+
endif
131142
CSRCS += $(NNG_SRCDIR)/supplemental/util/platform.c
132143
CSRCS += $(NNG_SRCDIR)/supplemental/websocket/websocket.c
133144

0 commit comments

Comments
 (0)