aiocoap
aiocoap copied to clipboard
Use initial block number specified in Block2 request
This PR allows the client to specify initial block number that should be transmitted. This is useful in a case when the client is resuming the request for some reason (a reset for example).
I might be wrong, but AFAICT this would always fail because block message assembly assumes it starts at 0. Do you have a code example that would actually make use of this? (I'd need one for the unit tests anyway.)
Are you referring to message assembly in aiocoap? I haven't looked into that, so you might be right. I'm using an in-house COAP client running on an embedded device. The scenario that download restarts from non-zero block is not that uncommon, hence the PR.
if you do blockwise yourself, the application should return False to the resource's needs_blockwise_assembly async method (possibly that should be simplifyed so a class attribute .needs_bockwise_assembly=False or similar can be set); then the server-side block handling code, including the patched line, will not be used.
does that work for your use case?