[riot-notifications] [RIOT-OS/RIOT] sys/net/gcoap: Use socket _buf API to recognize truncated requests (#16378)

Martine Lenders notifications at github.com
Wed Aug 25 16:46:25 CEST 2021

Mh, so you are basically "misusing" the `_buf` API for a different than the intended use case, gotcha!

> The point of this is to allow the stack to fail gracefully (allowing the protocol to continue rather than deadlocking it) when overly long messages arrive, which generally means to ask for smaller bites of data. An application will pick its buffer in accordance with the messages it expects, so if someone wants to haul 1KiB messages, they can up their buffer.

Mh, but consider this: we only put the header of a packet into the internal buffer and for the rest an application may choose to use:

/* just a sketch! */
while ((res = gcoap_get_payload(pkt, &buf[pos]) > 0) {
    pos += res;

this way, a developer does not need to beat themselves over the head of configuring some module they may or may non know about and can do all the necessary compile-time config in the app. No '"get follow-up or "yeah but there's a pointer you can follow up on and need to free" stuff' required, if we establish that _this_ is the way to get a packet's payload.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210825/4223f4a6/attachment-0001.htm>

More information about the notifications mailing list