24#define OUTBOX_QUEUE_MAX 6
97 for (
int i = 0; i < outbox->
queue_len; i++)
144 for (
int i = 1; i < outbox->
queue_len; i++)
static void outbox_hold_failed(OutboxQueue *outbox, OutboxJob job)
Hold a nacked job for the next pass, if it still has retries.
Definition outbox_queue.h:193
static bool outbox_push(OutboxQueue *outbox, OutboxKind kind, int retries)
Add a job to the work queue unless its kind is already pending.
Definition outbox_queue.h:124
OutboxKind
What an outbox job sends.
Definition outbox_queue.h:30
static bool outbox_busy(const OutboxQueue *outbox)
Whether anything is in flight, which is what says the outbox is busy.
Definition outbox_queue.h:68
static int outbox_retry_pass(OutboxQueue *outbox)
Move the whole failed set back into the work queue for another pass.
Definition outbox_queue.h:216
static bool outbox_pending(const OutboxQueue *outbox, OutboxKind kind)
Whether this kind is already somewhere in the outbox.
Definition outbox_queue.h:83
static void outbox_clear(OutboxQueue *outbox)
Forget everything waiting, for a phone that is no longer there.
Definition outbox_queue.h:242
static void outbox_take_head(OutboxQueue *outbox)
Take the head of the queue as the job now in flight.
Definition outbox_queue.h:163
static void outbox_pop_front(OutboxQueue *outbox)
Drop the front job off the work queue, shifting the rest forward.
Definition outbox_queue.h:142
static OutboxJob outbox_release(OutboxQueue *outbox)
Mark whatever was in flight as settled, whichever way it went.
Definition outbox_queue.h:180
#define OUTBOX_QUEUE_MAX
Most jobs the work queue or the failed set holds at once.
Definition outbox_queue.h:24
@ OUTBOX_STOCK
A stock request.
Definition outbox_queue.h:35
@ OUTBOX_CALENDAR
A calendar request.
Definition outbox_queue.h:36
@ OUTBOX_FRESH
The short settings reply, only whether the watch booted with nothing saved.
Definition outbox_queue.h:34
@ OUTBOX_SETTINGS
The settings reply.
Definition outbox_queue.h:33
@ OUTBOX_NONE
The zero value, so a default-initialized job slot reads as nothing rather than a real request.
Definition outbox_queue.h:31
@ OUTBOX_WEATHER
A weather request.
Definition outbox_queue.h:32
One job waiting to go out, or already in flight.
Definition outbox_queue.h:43
OutboxKind kind
What this job sends.
Definition outbox_queue.h:44
int retries_left
Retry passes left after a failed send.
Definition outbox_queue.h:45
Everything the outbox is holding: what is waiting, what nacked, and what is out.
Definition outbox_queue.h:54
OutboxJob queue[OUTBOX_QUEUE_MAX]
This pass's work queue, oldest first.
Definition outbox_queue.h:55
OutboxJob inflight
The job in flight, OUTBOX_NONE when nothing is out.
Definition outbox_queue.h:59
int failed_len
How many jobs are in the failed set.
Definition outbox_queue.h:58
OutboxJob failed[OUTBOX_QUEUE_MAX]
Requests that nacked this pass, held for the next.
Definition outbox_queue.h:57
int queue_len
How many jobs are in the queue.
Definition outbox_queue.h:56