mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-02 16:05:50 +03:00
net.c: fixed calculation of mask bit for no-response option
* The shift in function no_response was off by one bit. * The response code must be checked, not the request method.
This commit is contained in:
1 parent
bf9a3c7a1b
commit
6db8e5172d
1 file changed
+6
-2
@@ -1325,8 +1325,12 @@ no_response(coap_pdu_t *request, coap_pdu_t *response) {
|
||||
val = coap_decode_var_bytes(coap_opt_value(nores), coap_opt_length(nores));
|
||||
}
|
||||
|
||||
return (COAP_RESPONSE_CLASS(request->hdr->code) > 0)
|
||||
&& (((2 << (COAP_RESPONSE_CLASS(request->hdr->code) - 1)) & val) > 0);
|
||||
debug("response class is %d (bit %d), val is %02x\n",
|
||||
COAP_RESPONSE_CLASS(response->hdr->code),
|
||||
(1 << (COAP_RESPONSE_CLASS(response->hdr->code) - 1)),
|
||||
val);
|
||||
return (COAP_RESPONSE_CLASS(response->hdr->code) > 0)
|
||||
&& (((1 << (COAP_RESPONSE_CLASS(response->hdr->code) - 1)) & val) > 0);
|
||||
}
|
||||
|
||||
#define WANT_WKC(Pdu,Key) \
|
||||
|
||||
Reference in new issue
Block a user