coap_io_pending: Add in new function to check if there is any i/o pending

coap_io_pending() checks to see if there are any PDUs pending transmission,
whether there are any large (block) transmissions in progress, whether
there are still expected response packets(client) or expected request
packets(server), and whether the client is expecting further observe
responses.  If any of this is true, then it returns 1, else 0.

coap_io_pending() also invokes coap_io_process() to check that all that can
be transmitted is, as well as processes any impending input packets.

This takes coap_can_exit() a step further who only checks the transmit state.

coap_handle_response_get_block() has been updated to release the current
lg_crcv if all the fragmented body of a large transfer have been received.

Documentation updated.
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2022-11-04 14:06:55 +00:00
1 parent 3897d2334c
commit 710a8b5288
9 files changed
+161 -43

No files matched your search

+14
View File
@@ -643,6 +643,20 @@ int coap_io_process_with_fds(coap_context_t *ctx, uint32_t timeout_ms,
fd_set *exceptfds);
#endif /* !RIOT_VERSION */
/**
* Check to see if there is any i/o pending for the @p context.
*
* This includes Observe active (client) and partial large block transfers.
*
* coap_io_process() is called internally to try to send outstanding
* data as well as process any packets just received.
*
* @param context The CoAP context.
*
* @return @c 1 I/O still pending, @c 0 no I/O pending.
*/
int coap_io_pending(coap_context_t *context);
/**@}*/
/**