Loading...
Searching...
No Matches
outbox_queue.h File Reference

The outbox's work queue, its failed set, and the slot holding whatever is in flight. More...

#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  OutboxJob
 One job waiting to go out, or already in flight. More...
struct  OutboxQueue
 Everything the outbox is holding: what is waiting, what nacked, and what is out. More...

Macros

#define OUTBOX_QUEUE_MAX   6
 Most jobs the work queue or the failed set holds at once.

Enumerations

enum  OutboxKind {
  OUTBOX_NONE , OUTBOX_WEATHER , OUTBOX_SETTINGS , OUTBOX_FRESH ,
  OUTBOX_STOCK , OUTBOX_CALENDAR
}
 What an outbox job sends. More...

Functions

static bool outbox_busy (const OutboxQueue *outbox)
 Whether anything is in flight, which is what says the outbox is busy.
static bool outbox_pending (const OutboxQueue *outbox, OutboxKind kind)
 Whether this kind is already somewhere in the outbox.
static bool outbox_push (OutboxQueue *outbox, OutboxKind kind, int retries)
 Add a job to the work queue unless its kind is already pending.
static void outbox_pop_front (OutboxQueue *outbox)
 Drop the front job off the work queue, shifting the rest forward.
static void outbox_take_head (OutboxQueue *outbox)
 Take the head of the queue as the job now in flight.
static OutboxJob outbox_release (OutboxQueue *outbox)
 Mark whatever was in flight as settled, whichever way it went.
static void outbox_hold_failed (OutboxQueue *outbox, OutboxJob job)
 Hold a nacked job for the next pass, if it still has retries.
static int outbox_retry_pass (OutboxQueue *outbox)
 Move the whole failed set back into the work queue for another pass.
static void outbox_clear (OutboxQueue *outbox)
 Forget everything waiting, for a phone that is no longer there.

Detailed Description

The outbox's work queue, its failed set, and the slot holding whatever is in flight.

One AppMessage goes out at a time, so everything the watch wants to send queues here first. A job the phone nacks is held in the failed set and moved back for a later pass, because its pkjs was usually asleep or busy and that first send is often what wakes it. Holding it means a whole poll, or the one settings reply a launch gets, is not lost to one nack.

None of that needs the SDK. The transport owns one of these, does the sending and the timers, and asks here what to send next, which keeps the deciding testable on the host.