From 1980b94728240567a348d750d794236dbc789f5d Mon Sep 17 00:00:00 2001 From: M Aiman Ismail Date: Thu, 9 Jul 2020 10:17:05 +0200 Subject: [PATCH] examples/dtls-echo: fix silent fail with ECC --- examples/dtls-echo/dtls-client.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/dtls-echo/dtls-client.c b/examples/dtls-echo/dtls-client.c index baa5d92915..f8ab7e9221 100644 --- a/examples/dtls-echo/dtls-client.c +++ b/examples/dtls-echo/dtls-client.c @@ -43,9 +43,9 @@ /* Delay to give time to the remote peer to do the compute (client only). */ #ifdef CONFIG_DTLS_ECC -#define DEFAULT_US_DELAY 10000000 +#define DEFAULT_US_DELAY (20 * US_PER_SEC) #else -#define DEFAULT_US_DELAY 100 +#define DEFAULT_US_DELAY (1 * US_PER_SEC) #endif static int dtls_connected = 0; /* This is handled by Tinydtls callbacks */ @@ -108,7 +108,7 @@ static int dtls_handle_read(dtls_context_t *ctx) } ssize_t res = sock_udp_recv(sock, packet_rcvd, sizeof(packet_rcvd), - 1 * US_PER_SEC + DEFAULT_US_DELAY, &remote); + DEFAULT_US_DELAY, &remote); if (res <= 0) { if ((ENABLE_DEBUG) && (res != -EAGAIN) && (res != -ETIMEDOUT)) { @@ -455,6 +455,11 @@ static void client_send(char *addr_str, char *data) watch--; } /* END while */ + /* check if we failed to send */ + if ((app_data_buf != 0)) { + printf("Failed to send the data\n"); + } + /* * BUG: tinyDTLS (<= 0.8.6) * If dtls_connect() is called but the handshake does not complete (e.g.