pdcomm_tcp_poll
Function
Performs pending socket I/O and HSMS timer processing.
PdcommStatus pdcomm_tcp_poll(PdcommTcpEndpoint *endpoint, size_t *progressed)One call performs up to PdcommTcpOptions::poll_budget internal actions: connecting or accepting, reading and writing frames, answering control messages, expiring the T3, T5, T6, T7, and T8 timers, and moving results to the event queue. Retrieve the results with pdcomm_tcp_next_event(). Failures of the connection itself are reported as events, not as the returned status.
Parameters
| Name | Description |
|---|---|
endpoint | Live endpoint. |
progressed | Receives the number of internal actions that made progress, which is not the number of events produced. Set to 0 first whenever it is not NULL. Must not be NULL. |
Returns
#PDCOMM_OK when the poll step completed; #PDCOMM_INVALID_ARGUMENT when endpoint or progressed is NULL; #PDCOMM_BACKPRESSURE when an event is staged (see pdcomm_tcp_next_event()) or internal queues cannot accept more results; #PDCOMM_IO_ERROR when accepting a connection failed; #PDCOMM_LIMIT_EXCEEDED when a timer deadline overflows; #PDCOMM_INTERNAL_ERROR when the monotonic clock went backwards; #PDCOMM_POISONED.
Notes
- An active connection attempt blocks this call for up to PdcommTcpOptions::connect_timeout_ms.
- An empty event queue does not mean that the session is finished; keep polling while the endpoint is in use.
- When a GEM role is configured, the call also updates the GEM state.