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)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
success1 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 recordssuccess_acceptedanddequeue_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
success0 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
| Name | Description |
|---|---|
endpoint | Synchronized, Communicating Equipment endpoint with a spool. |
result | Delivery result from pdcomm_gem_handle_event(). |
success | 1 to accept the delivery, 0 to reject it; other values are invalid. |
info | Receives 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.