Commit 1dc24872 authored by Seppo Takalo's avatar Seppo Takalo Committed by Mahesh Mahadevan
Browse files

net: lib: coap_client: Remove duplicate token comparison



Response tokens are already compared in get_request_with_token().

Signed-off-by: default avatarSeppo Takalo <seppo.takalo@nordicsemi.no>
parent e96e95b6
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -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");