From d32846591e0249901b0d8085d117b96b73320d05 Mon Sep 17 00:00:00 2001 From: Aiman Ismail Date: Wed, 6 Nov 2019 10:38:10 +0100 Subject: [PATCH] fixup! add DTLS in gcoap --- examples/gcoap/Makefile | 1 + examples/gcoap/gcoap_cli.c | 5 ++--- sys/net/application_layer/gcoap/gcoap.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/gcoap/Makefile b/examples/gcoap/Makefile index cdcf17219a737..0f3040c31bbd4 100644 --- a/examples/gcoap/Makefile +++ b/examples/gcoap/Makefile @@ -34,6 +34,7 @@ USEMODULE += gnrc_icmpv6_echo # DTLS configuration # Choose which DTLS stack to use USEMODULE += tinydtls_sock_dtls # tinyDTLS +USEMODULE += gcoap_lazy_init CFLAGS += -DDTLS_PSK #USEMODULE += wolfssl_sock_dtls # wolfSSL diff --git a/examples/gcoap/gcoap_cli.c b/examples/gcoap/gcoap_cli.c index 9e829c3d1b00e..317506ec6f119 100644 --- a/examples/gcoap/gcoap_cli.c +++ b/examples/gcoap/gcoap_cli.c @@ -399,7 +399,7 @@ int gcoap_cli_cmd(int argc, char **argv) void gcoap_cli_init(void) { #ifdef MODULE_SOCK_DTLS - /* load credentials into pool with credman */ + /* declare DTLS credential to use */ credman_credential_t credential = { .type = CREDMAN_TYPE_PSK, .tag = SOCK_DTLS_GCOAP_TAG, @@ -418,7 +418,6 @@ void gcoap_cli_init(void) /* tell gcoap with tag to use */ gcoap_set_credential_tag(SOCK_DTLS_GCOAP_TAG); #endif - /* starts the gcoap server */ - gcoap_init(); + gcoap_register_listener(&_listener); } diff --git a/sys/net/application_layer/gcoap/gcoap.c b/sys/net/application_layer/gcoap/gcoap.c index cd943926957a3..5a69ce3f6e37d 100644 --- a/sys/net/application_layer/gcoap/gcoap.c +++ b/sys/net/application_layer/gcoap/gcoap.c @@ -695,6 +695,7 @@ static kernel_pid_t _start_server(void) } _pid = thread_create(_msg_stack, sizeof(_msg_stack), THREAD_PRIORITY_MAIN - 1, THREAD_CREATE_STACKTEST, _event_loop, NULL, "coap"); + DEBUG("gcoap: server started\n"); return _pid; }