go-coap icon indicating copy to clipboard operation
go-coap copied to clipboard

Blockwise transfer shouldn't be sent as NON

Open kegsay opened this issue 4 years ago • 1 comments

The present specification minimizes the constraints it adds to those base exchanges; however, not all variants of using CoAP are very useful inside a block-wise transfer (e.g., using Non-confirmable requests within block-wise transfers outside the use case of Section 2.8 would escalate the overall non-delivery probability).

https://datatracker.ietf.org/doc/html/rfc7959#section-1

Currently, this library will request each block as non-confirmable, resulting in a high non-delivery probability as the number of blocks increases. I've isolated the cause to https://github.com/plgd-dev/go-coap/blob/v2.4.0/udp/client/clientconn.go#L642 which sets the packet as NON, but replacing that line with CON causes the library to infinitely retransmit packets because when the server sends back the ACK it has the same MID which then gets pulled from the cache https://github.com/plgd-dev/go-coap/blob/v2.4.0/udp/client/clientconn.go#L608:L620 - this looks like a retransmission in Wireshark.

I don't know enough about the state machine to fix this easily unfortunately.

kegsay avatar Jun 03 '21 12:06 kegsay

This was fixed - currently, it uses CON messages for BWT. Fixed by PR #241

jkralik avatar Sep 28 '21 18:09 jkralik