Skip to content

check timeout even if userspace#29

Merged
edvardxyz merged 1 commit intomasterfrom
rdp_check_timeout
Jun 6, 2025
Merged

check timeout even if userspace#29
edvardxyz merged 1 commit intomasterfrom
rdp_check_timeout

Conversation

@edvardxyz
Copy link

@edvardxyz edvardxyz commented Jun 2, 2025

After this commit we wait for tx window space or connection timeout.
If we lose connection we will get stuck indefinitely, waiting for tx window.

libcsp/src/csp_rdp.c

Lines 803 to 820 in cb3f265

int csp_rdp_send(csp_conn_t * conn, csp_packet_t * packet) {
if (conn->rdp.state != RDP_OPEN) {
csp_rdp_error("RDP %p: ERROR cannot send, connection not open (%d)\n", (void *)conn, conn->rdp.state);
return CSP_ERR_RESET;
}
/* Wait here for RDP to become ready or the connection to be closed */
while (1) {
if (conn->rdp.state == RDP_CLOSE_WAIT || conn->rdp.state == RDP_CLOSED) {
csp_rdp_error("RDP %p: ERROR cannot send, connection closed by peer or timeout\n", (void *)conn);
return CSP_ERR_RESET;
}
if (csp_rdp_is_conn_ready_for_tx(conn) == true)
break;
csp_rdp_protocol("RDP %p: Waiting for window update before sending seq %u\n", (void *)conn, conn->rdp.snd_nxt);
csp_bin_sem_wait(&conn->rdp.tx_wait, conn->rdp.conn_timeout);
}

Because we block the userspace with csp_send they can't use

bool csp_rdp_conn_is_active(csp_conn_t *conn) {

I assume we do not want to do the connection check inside csp_rdp_send?

@edvardxyz edvardxyz merged commit e96c578 into master Jun 6, 2025
60 of 102 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant