samples: net: sockets: coap_server: fix separate response MID reuse

Fixes #71620 by generating a different CoAP message ID for the
separate response.

Signed-off-by: Julien Vermillard <julien@vermillard.com>
This commit is contained in:
Julien Vermillard 2024-04-17 18:53:37 +02:00 committed by Alberto Escolar
parent d0be2010c3
commit ca1705d730

View file

@ -57,7 +57,7 @@ static int separate_get(struct coap_resource *resource,
/* Re-use the buffer */
r = coap_packet_init(&response, data, sizeof(data),
COAP_VERSION_1, type, tkl, token,
COAP_RESPONSE_CODE_CONTENT, id);
COAP_RESPONSE_CODE_CONTENT, coap_next_id());
if (r < 0) {
return r;
}