Cancel the message in flight, and the small things from the review

rb9704_cancel() and `rb9704 cancel` ask the modem to abandon the MO in
flight; the modem's final status reaches mo_done as -ECANCELED. The
library's async path has no timeout, so this is how an application
frees a modem that has gone quiet mid-send. The status snapshot carries
the in-flight message's id and start time for the application to decide
with.

rb9704_begin zeroes moQueuedMessages: rbBegin empties the queue but not
the count, and a count above zero makes every later send queue without
transmitting.

The fake modem's mo-hold and mo-release stand in for a modem that has
taken a message and said nothing more; a test drives cancel through it.

Also: the shell's send buffer is a shell line, not a fourth message
buffer; the bridge's TX-disable race has a comment; the CLI turns a
Cloudloop error (a bad token's 200 reply included), an unopenable port
and a one-word jspr line into one line and exit 1; conftest reads
request.node; pyproject uses the current license spelling.
This commit is contained in:
scottp committed 2026-10-21 22:43:05 +11:00
1 parent 509b9b5b6d
commit f97fcab74b
13 files changed
+235 -34

No files matched your search

+16 -1
View File
@@ -81,6 +81,8 @@ struct rb9704_status {
/* messages */
bool mo_in_flight;
uint16_t mo_topic;
uint16_t mo_id; /* the modem's id for it */
int64_t mo_started_ms; /* uptime when the modem accepted it */
uint32_t mo_sent, mo_failed;
uint32_t mt_received, mt_failed;
/* the serial port */
@@ -99,7 +101,8 @@ struct rb9704_mt {
* blocking rb9704_* request from one: the worker is the thread that would
* have to answer it. Any member may be NULL. */
struct rb9704_callbacks {
/* An MO has finished: result 0 when the network has it. */
/* An MO has finished: result 0 when the network has it, -ECANCELED
* after rb9704_cancel, -EIO otherwise. */
void (*mo_done)(uint16_t topic, uint16_t id, int result, void *user);
/* An MT has arrived whole. It is acknowledged to the modem after this
* returns, so copy what is wanted. */
@@ -141,6 +144,18 @@ int rb9704_end(k_timeout_t timeout);
*/
int rb9704_send(uint16_t topic, const void *data, size_t len, k_timeout_t timeout);
/* Ask the modem to abandon the message in flight. Returns 0 once the
* request is on the wire; the outcome, -ECANCELED when the modem agrees,
* comes through mo_done, and until then the message counts as in flight.
* The library has no timeout of its own, so this is how an application
* frees a modem that has gone quiet mid-send; a modem that does not answer
* the cancel either is reset by rb9704_end and rb9704_begin.
*
* -ENOTCONN not begun
* -ENOENT nothing in flight
*/
int rb9704_cancel(k_timeout_t timeout);
/* Ask the modem who it is. Free, milliseconds. */
int rb9704_info(struct rb9704_info *out, k_timeout_t timeout);