net: lib: coap_client: Remove duplicate token comparison

Response tokens are already compared in get_request_with_token().

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This commit is contained in:
Seppo Takalo 2024-10-25 13:32:43 +03:00 committed by Mahesh Mahadevan
parent e96e95b6f6
commit 1dc24872ce

View file

@ -594,21 +594,6 @@ static int handle_poll(void)
return 0;
}
static bool token_compare(struct coap_client_internal_request *internal_req,
const struct coap_packet *resp)
{
uint8_t response_token[COAP_TOKEN_MAX_LEN];
uint8_t response_tkl;
response_tkl = coap_header_get_token(resp, response_token);
if (internal_req->request_tkl != response_tkl) {
return false;
}
return memcmp(&internal_req->request_token, &response_token, response_tkl) == 0;
}
static int recv_response(struct coap_client *client, struct coap_packet *response, bool *truncated)
{
int total_len;
@ -768,11 +753,6 @@ static int handle_response(struct coap_client *client, const struct coap_packet
return 0;
}
if (internal_req == NULL || !token_compare(internal_req, response)) {
LOG_WRN("Not matching tokens");
return 1;
}
/* MID-based deduplication */
if (response_id == internal_req->last_response_id) {
LOG_WRN("Duplicate MID, dropping");