From 7b463b6c9545eb1bc13534edf8a21f00bbd9d848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Mon, 9 Dec 2019 14:17:26 +0100 Subject: [PATCH] dtls-echo: check msg_try_receive return value --- examples/dtls-echo/dtls-server.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/dtls-echo/dtls-server.c b/examples/dtls-echo/dtls-server.c index 1bdf7980e2..2f7b2f1284 100644 --- a/examples/dtls-echo/dtls-server.c +++ b/examples/dtls-echo/dtls-server.c @@ -345,9 +345,7 @@ void *_dtls_server_wrapper(void *arg) } while (active) { - - msg_try_receive(&msg); /* Check if we got an (thread) message */ - if (msg.type == DTLS_STOP_SERVER_MSG) { + if ((msg_try_receive(&msg) == -1) && (msg.type == DTLS_STOP_SERVER_MSG)) { active = false; } else {