1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

nanocoap/cache: use coap_get_code_raw()

This commit is contained in:
Benjamin Valentin 2023-10-20 15:14:04 +02:00
parent 7da2817d4c
commit 54362e2c2a
2 changed files with 3 additions and 3 deletions

View File

@ -1180,7 +1180,7 @@ static void _cache_process(gcoap_request_memo_t *memo,
#if IS_USED(MODULE_NANOCOAP_CACHE) #if IS_USED(MODULE_NANOCOAP_CACHE)
nanocoap_cache_entry_t *ce; nanocoap_cache_entry_t *ce;
/* cache_key in memo is pre-processor guarded so we need to as well */ /* cache_key in memo is pre-processor guarded so we need to as well */
if ((ce = nanocoap_cache_process(memo->cache_key, coap_get_code(&req), pdu, pdu_len))) { if ((ce = nanocoap_cache_process(memo->cache_key, coap_get_code_raw(&req), pdu, pdu_len))) {
ce->truncated = (memo->state == GCOAP_MEMO_RESP_TRUNC); ce->truncated = (memo->state == GCOAP_MEMO_RESP_TRUNC);
} }
#else #else
@ -1288,7 +1288,7 @@ static bool _cache_lookup(gcoap_request_memo_t *memo,
_update_memo_cache_key(memo, cache_key); _update_memo_cache_key(memo, cache_key);
/* cache hit, methods are equal, and cache entry is not stale */ /* cache hit, methods are equal, and cache entry is not stale */
if (*ce && if (*ce &&
((*ce)->request_method == coap_get_code(pdu)) && ((*ce)->request_method == coap_get_code_raw(pdu)) &&
!nanocoap_cache_entry_is_stale(*ce, now)) { !nanocoap_cache_entry_is_stale(*ce, now)) {
return true; return true;
} }

View File

@ -305,7 +305,7 @@ nanocoap_cache_entry_t *nanocoap_cache_add_by_req(const coap_pkt_t *req,
nanocoap_cache_key_generate(req, cache_key); nanocoap_cache_key_generate(req, cache_key);
return nanocoap_cache_add_by_key(cache_key, return nanocoap_cache_add_by_key(cache_key,
coap_get_code((coap_pkt_t *)req), coap_get_code_raw((coap_pkt_t *)req),
resp, resp,
resp_len); resp_len);
} }