pdcomm_tcp_cancel
Function
Cancels an open transaction.
PdcommStatus pdcomm_tcp_cancel(PdcommTcpEndpoint *endpoint, PdcommTcpToken token, uint8_t *cancelled)A cancelled transaction produces a #PDCOMM_TCP_FAILED event with #PDCOMM_TCP_CANCELLED, and a later reply to it is reported as #PDCOMM_TCP_UNEXPECTED_REPLY. A queued frame that has not been written is discarded. Cancelling a frame that is partially written closes the connection, because bytes already on the wire cannot be retracted.
Parameters
| Name | Description |
|---|---|
endpoint | Live endpoint. |
token | Token from pdcomm_tcp_request(), pdcomm_tcp_select(), pdcomm_tcp_deselect(), or pdcomm_tcp_linktest(); reserved must be 0. |
cancelled | Receives 1 when an open transaction was cancelled, or 0 when it had already ended; set to 0 first. Must not be NULL. |
Returns
#PDCOMM_OK on success, whether or not anything was cancelled; #PDCOMM_INVALID_ARGUMENT when cancelled or endpoint is NULL, or token.reserved is nonzero; #PDCOMM_STALE_TOKEN when the token belongs to another endpoint or an earlier generation; #PDCOMM_BACKPRESSURE when an event is staged, the event queue is full, or the endpoint is stopping; #PDCOMM_POISONED.