Skip to content

gcoap: error signaling for gcoap_req_send() insufficient #12780

@haukepetersen

Description

@haukepetersen

Description

Currently, gcoap_req_send() only has a single return value for all possible error cases. This is not sufficient, as it strips information that is mandatory for certain use cases of the API.

Example: flooding out large amounts of data. When sending a large amount of user data over CoAP as fast as possible (e.g. flood or throughput tests), one would e.g. use code like:

    do {
        res = gcoap_req_send(_txbuf, (hdr_len + len), remote, NULL);
    } while (res == ERROR_CODE_FOR_BUFFER_FULL);

Hoever, as gcoap_req_res() returns 0 for any kind of error, this code does break when for example exceeding the link layers MTU size with our payload -> sock_udp_send() returning -EMSGSIZE.

Steps to reproduce the issue

Run the code above for large payload sizes (payload exceeding you link capacity, e.g. > 1500 on native). The loop is never left.

Expected results

gcoap should return differentiated errors so the user can react accordingly.

Actual results

see above.

Versions

any :-)

Metadata

Metadata

Labels

State: staleState: The issue / PR has no activity for >185 days

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions