Skip to content
Commit ed025b2f authored by Benjamin Lindqvist's avatar Benjamin Lindqvist Committed by Anas Nashif
Browse files

net: lib: coap_client: observe-related fixes



An earlier pull request implementing observe support was merged too
hastily. It had a few issues:

1. The predicate for whether a request should be marked not ongoing was
wrong (it checked ret != 0 instead of ret < 0)
2. Without observes in mind, MID-based deduplication is not a required
feature. Deduplication was handled implicitly - the exchange would get
dropped after the first response anyway, so duplicate responses would
not get matched to anything. But with observes, there are several
responses in an exchange. This commit adds this.
3. Using coap_request_is_observe(&internal_req->request) in the response
handler requires the whole request to stay in scope for the lifetime of
the observation, which I observed was not always the case. Adding an
is_observe bool to the internal struct improved stability significantly.

With these fixes, GETs with observe option works very well.

Signed-off-by: default avatarBenjamin Lindqvist <benjamin@eub.se>
parent 85755dd8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment