From 2c8da3586a4386c26740904569d12b6109774391 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Thu, 17 Mar 2016 15:22:46 +0100 Subject: [PATCH] net.c: bugfix: call coap_read_endpoint() only when data available coap_read_endpoint() should not be called when no data is available on the attached endpoint. --- src/net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/net.c b/src/net.c index 9357d852..421fbd30 100644 --- a/src/net.c +++ b/src/net.c @@ -917,7 +917,9 @@ coap_read(coap_context_t *ctx) { * help with anything, so we set it simply to the last return value * retrieved from coap_read_endpoint(). */ LL_FOREACH_SAFE(ctx->endpoint, ep, tmp) { - result = coap_read_endpoint(ctx, ep); + if ((ep->flags & COAP_ENDPOINT_HAS_DATA) != 0) { + result = coap_read_endpoint(ctx, ep); + } } return result;