Skip to content
Start free evaluation

pdcomm_gem_spool_complete_delivery

Function

Completes a delivery attempt and dequeues the head on success.

PdcommStatus pdcomm_gem_spool_complete_delivery(PdcommTcpEndpoint *endpoint, PdcommGemResult *result, uint8_t success, PdcommGemSpoolWriteInfo *info)

Declared in: #include <pdcomm_gem_spooling.h>

result must be the delivery result of the current in-flight attempt: #PDCOMM_GEM_SPOOL_DELIVERY_RESPONSE for a W1 message or #PDCOMM_GEM_SPOOL_DELIVERY_WRITTEN for a W0 message. A failed delivery result carries no usable proof.

  • With success 1 the head is dequeued (#PDCOMM_GEM_SPOOL_REMOVED). For W1 messages, inspect the reply body first and apply your own message-specific success policy; a matching function alone is not a success policy. W0 proof means the frame was fully written locally, not that the Host received or processed it. When the dequeue fails before installation, the result records success_accepted and dequeue_pending; finish it with pdcomm_gem_spool_retry_dequeue() without sending again. A dequeue installed with #PDCOMM_SPOOL_UNCONFIRMED is already complete; never dequeue it again.
  • With success 0 the head is kept and the transmission run stops.

The run also stops when the queue becomes empty or max_transmit is reached. Delivery is at least once, not exactly once: proofs superseded by a selection change can be rejected even after a write, and recovery can send a message again.

Parameters

NameDescription
endpointSynchronized, Communicating Equipment endpoint with a spool.
resultDelivery result from pdcomm_gem_handle_event().
success1 to accept the delivery, 0 to reject it; other values are invalid.
infoReceives the dequeue outcome. Must not be NULL.

Returns

#PDCOMM_OK on success (also for a rejection); #PDCOMM_SPOOL_UNCONFIRMED when the dequeue was installed without a confirmed directory sync; #PDCOMM_STALE_TOKEN when the result is from another endpoint, generation, or selection, was already completed, or does not match the in-flight attempt; #PDCOMM_INVALID_STATE when the result is not a delivery result, GEM is not Communicating, or the spool is not synchronized; #PDCOMM_INVALID_ARGUMENT for a NULL argument, a short info, or success above 1; #PDCOMM_BACKPRESSURE when a staged TCP event is pending; a persistence error such as #PDCOMM_IO_ERROR when the dequeue is left pending; #PDCOMM_POISONED.