net: lwm2m: firmware_pull: fix multiple last_block notifications
When the firmware_pull mechansim sends the callback to notify the sample of a new firmware block, the user supplied buffer can be smaller than the CoAP BLOCK_SIZE setting. To handle this case, we loop through the payload and fill the user supplied buffer with smaller chunks. Unfortunately, the last_block calculation is done outside this loop which causes several callbacks (while in this loop) to have last_block true. Let's fix this by adding a small check to make sure we're at the end of the current payload block before notifying the user of a last_block. Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/16158 Signed-off-by:Michael Scott <mike@foundries.io>
Loading
Please sign in to comment