Get all partial packages received instead of discarding them?
Opened this issue · 3 comments
Hi,
I'm sending a large message from an embedded client. If I only eg. get, lets say 9 out of 10 messages through, all packages will get lost due to a retransmission timeout. What will be the best way to catch a timeout exception and retrieve the received bytes before the message gets released from memory?
Just to clarify: The embedded client sends a block-wise request with a large request body that gets fragmented. The CoAP server is implemented in aiocoap, and is supposed to process what has been received. Is that right?
If so, there are two avenues:
- Notifying the application on partial requests being evicted is currently not implemented. Might be feasible, though, as an extension; will need good understanding of use cases.
- The handler can opt out of the server-side block-wise processing. For that, it'd implement
async def needs_blockwise_assembly(self, request)
toreturn False
, or implementrender_to_pipe
right away. The server will then be fed the blocks individually. Then it can either act on the requests as they come in, or use some mechanisms otherwise implemented (currently) inaiocoap.interfaces.Resource._redner_to_pipe
. Note that the helpers that takes fromaiocoap.blockwise
are not exactly super stable API, so if you use them, consider pinning your aiocoap version precisely. The change log will tell when things happen there.
The use case you describe is exactly right.
I am investigating solution number 2. If a block wise transfer is ongoing from client -> server, when does the server stop listening for the new messages - what part of the code schedules this?