1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gcoap_fileserver: don't abort on duplicate packet

This commit is contained in:
Benjamin Valentin 2022-10-12 00:45:28 +02:00
parent b35a291332
commit be1c46ef27

View File

@ -275,7 +275,13 @@ static ssize_t _put_file(coap_pkt_t *pdu, uint8_t *buf, size_t len,
if ((ret = vfs_lseek(fd, 0, SEEK_END)) < 0) {
goto close_on_error;
}
if (block1.offset != (unsigned)ret) {
if (block1.offset < (unsigned)ret) {
/* ignore duplicate packet */
create = false; /* don't delete file */
ret = COAP_CODE_CONTINUE;
goto close_on_error;
}
if (block1.offset > (unsigned)ret) {
/* expect block to be in the correct order during initial creation */
ret = COAP_CODE_REQUEST_ENTITY_INCOMPLETE;
goto close_on_error;