Skip to content
Snippets Groups Projects
Commit ddf723f8 authored by Nicolas Tsiftes's avatar Nicolas Tsiftes Committed by GitHub
Browse files

Merge pull request #2180 from atiselsts/bugfix/coap-observe-option

Keep CoAP 'observe' option length <= 3 bytes
parents 66fe7abf f83f0358
No related branches found
No related tags found
No related merge requests found
......@@ -249,6 +249,8 @@ coap_notify_observers_sub(resource_t *resource, const char *subpath)
if(notification->code < BAD_REQUEST_4_00) {
coap_set_header_observe(notification, (obs->obs_counter)++);
/* mask out to keep the CoAP observe option length <= 3 bytes */
obs->obs_counter &= 0xffffff;
}
coap_set_token(notification, obs->token, obs->token_len);
......@@ -276,6 +278,8 @@ coap_observe_handler(resource_t *resource, void *request, void *response)
coap_req->uri_path, coap_req->uri_path_len);
if(obs) {
coap_set_header_observe(coap_res, (obs->obs_counter)++);
/* mask out to keep the CoAP observe option length <= 3 bytes */
obs->obs_counter &= 0xffffff;
/*
* Following payload is for demonstration purposes only.
* A subscription should return the same representation as a normal GET.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment