mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-15 17:43:51 +01:00
gcoap_fileserver: don't abort on duplicate packet
This commit is contained in:
parent
b35a291332
commit
be1c46ef27
@ -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) {
|
if ((ret = vfs_lseek(fd, 0, SEEK_END)) < 0) {
|
||||||
goto close_on_error;
|
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 */
|
/* expect block to be in the correct order during initial creation */
|
||||||
ret = COAP_CODE_REQUEST_ENTITY_INCOMPLETE;
|
ret = COAP_CODE_REQUEST_ENTITY_INCOMPLETE;
|
||||||
goto close_on_error;
|
goto close_on_error;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user