Skip to content

Commit 1dc2487

Browse files
SeppoTakalommahadevan108
authored andcommitted
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>
1 parent e96e95b commit 1dc2487

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

subsys/net/lib/coap/coap_client.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -594,21 +594,6 @@ static int handle_poll(void)
594594
return 0;
595595
}
596596

597-
static bool token_compare(struct coap_client_internal_request *internal_req,
598-
const struct coap_packet *resp)
599-
{
600-
uint8_t response_token[COAP_TOKEN_MAX_LEN];
601-
uint8_t response_tkl;
602-
603-
response_tkl = coap_header_get_token(resp, response_token);
604-
605-
if (internal_req->request_tkl != response_tkl) {
606-
return false;
607-
}
608-
609-
return memcmp(&internal_req->request_token, &response_token, response_tkl) == 0;
610-
}
611-
612597
static int recv_response(struct coap_client *client, struct coap_packet *response, bool *truncated)
613598
{
614599
int total_len;
@@ -768,11 +753,6 @@ static int handle_response(struct coap_client *client, const struct coap_packet
768753
return 0;
769754
}
770755

771-
if (internal_req == NULL || !token_compare(internal_req, response)) {
772-
LOG_WRN("Not matching tokens");
773-
return 1;
774-
}
775-
776756
/* MID-based deduplication */
777757
if (response_id == internal_req->last_response_id) {
778758
LOG_WRN("Duplicate MID, dropping");

0 commit comments

Comments
 (0)