1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

dtls, tinydtls: Raise default number of connections

This commit is contained in:
chrysn 2023-02-28 16:06:39 +01:00
parent f7a83a7edc
commit f2d5928ee5
3 changed files with 13 additions and 0 deletions

View File

@ -38,6 +38,7 @@ config DTLS_CONTEXT_MAX
config DTLS_PEER_MAX
int "Max number of peers"
default 2 if KCONFIG_USEMODULE_GCOAP_DTLS
default 1
help
The maximum number of DTLS peers.

View File

@ -63,6 +63,12 @@ endif
PEER_MAX := $(or $(CONFIG_DTLS_PEER_MAX),$(patsubst -DCONFIG_DTLS_PEER_MAX=%,%,$(filter -DCONFIG_DTLS_PEER_MAX=%,$(CFLAGS))))
ifneq (,$(PEER_MAX))
CFLAGS += -DDTLS_PEER_MAX=$(PEER_MAX)
else ifneq (,$(filter gcoap_dtls,$(USEMODULE)))
# The default value in sys/include/net/dtls.h for CONFIG_DTLS_PEER_MAX is 2
# when gcoap_dtls is active, otherwise 1. As the default in tinydtls is 1,
# we need to set it explicitly if the dtls.h default value deviates from
# the tinydtls default.
CFLAGS += -DDTLS_PEER_MAX=2
endif
HANDSHAKE_MAX := $(or $(CONFIG_DTLS_HANDSHAKE_MAX),$(patsubst -DCONFIG_DTLS_HANDSHAKE_MAX=%,%,$(filter -DCONFIG_DTLS_HANDSHAKE_MAX=%,$(CFLAGS))))

View File

@ -36,6 +36,8 @@
#ifndef NET_DTLS_H
#define NET_DTLS_H
#include "modules.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -44,8 +46,12 @@ extern "C" {
* @brief The maximum number DTLS peers (i.e. sessions)
*/
#ifndef CONFIG_DTLS_PEER_MAX
#if IS_USED(MODULE_GCOAP_DTLS)
#define CONFIG_DTLS_PEER_MAX (2)
#else
#define CONFIG_DTLS_PEER_MAX (1)
#endif
#endif
#ifdef __cplusplus
}