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.
This commit is contained in:
Olaf Bergmann committed 2016-03-17 15:22:46 +01:00
1 parent 467284605d
commit 2c8da3586a
1 file changed
+3 -1
+3 -1
View File
@@ -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;