Skip to content
Start free evaluation

pdcomm_gem_spool_send_next

Function

Sends the head of the spool queue during an accepted transmission.

PdcommStatus pdcomm_gem_spool_send_next(PdcommTcpEndpoint *endpoint, PdcommTcpToken *token)

Declared in: #include <pdcomm_gem_spooling.h>

Call after a Host S6F23 transmit request was accepted. Each call submits one message; no automatic loop sends the next head. A W1 message uses one of the 32 shared pending slots; a W0 message uses a separate single-flight token and no reply slot. Submission is not delivery: handle the following #PDCOMM_GEM_SPOOL_DELIVERY_RESPONSE, #PDCOMM_GEM_SPOOL_DELIVERY_WRITTEN, or #PDCOMM_GEM_SPOOL_DELIVERY_FAILED result and call pdcomm_gem_spool_complete_delivery() for a successful proof.

When the head cannot be submitted (no free pending slot for a W1 message, an invalid stored message, or a TCP send failure), the queue is kept and the current transmission run ends. When the queue is empty, the run ends and the call returns #PDCOMM_OUT_OF_RANGE. Calls made while not transmitting, busy, or unsynchronized submit nothing.

Parameters

NameDescription
endpointSynchronized, Communicating Equipment endpoint with a spool.
tokenReceives the token of the submitted message; zero after every failure. Must not be NULL.

Returns

#PDCOMM_OK when the head was submitted; #PDCOMM_OUT_OF_RANGE when the queue is empty; #PDCOMM_INVALID_STATE when no transmission run is active, the spool is not synchronized, or GEM is not Communicating; #PDCOMM_BACKPRESSURE when a staged TCP event is pending, a delivery or dequeue is pending, no pending slot is free for a W1 message, or the send queue is full; #PDCOMM_LIMIT_EXCEEDED when attempt numbers are exhausted or the message exceeds a limit; #PDCOMM_INVALID_ARGUMENT for a NULL argument, a TCP status, or #PDCOMM_POISONED.