From 2e7fb9700afab0ae6ee9249748122b200a437d8d Mon Sep 17 00:00:00 2001 From: Javier Tia Date: Fri, 26 Apr 2024 14:51:21 -0600 Subject: [PATCH] altcp_tls_mbedtls: tcp_out: Fix handshake when called from u-boot When using the http-client LWIP app in U-Boot (OS_SYS=0), the handshake fails because LWIP doesn't send TCP packets after it initiates. Signed-off-by: Javier Tia --- src/apps/altcp_tls/altcp_tls_mbedtls.c | 2 ++ src/core/tcp_out.c | 10 +--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/apps/altcp_tls/altcp_tls_mbedtls.c b/src/apps/altcp_tls/altcp_tls_mbedtls.c index 52a97404..59ded752 100644 --- a/src/apps/altcp_tls/altcp_tls_mbedtls.c +++ b/src/apps/altcp_tls/altcp_tls_mbedtls.c @@ -1292,6 +1292,8 @@ altcp_mbedtls_bio_send(void *ctx, const unsigned char *dataptr, size_t size) while (size_left) { u16_t write_len = (u16_t)LWIP_MIN(size_left, 0xFFFF); err_t err = altcp_write(conn->inner_conn, (const void *)dataptr, write_len, apiflags); + /* try to send data... */ + altcp_output(conn->inner_conn); if (err == ERR_OK) { written += write_len; size_left -= write_len; diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index cfcc55dd..e1eb624f 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -1255,14 +1255,6 @@ tcp_output(struct tcp_pcb *pcb) LWIP_ASSERT("don't call tcp_output for listen-pcbs", pcb->state != LISTEN); - /* First, check if we are invoked by the TCP input processing - code. If so, we do not output anything. Instead, we rely on the - input processing code to call us when input processing is done - with. */ - if (tcp_input_pcb == pcb) { - return ERR_OK; - } - wnd = LWIP_MIN(pcb->snd_wnd, pcb->cwnd); seg = pcb->unsent; @@ -2039,7 +2031,7 @@ tcp_rst(const struct tcp_pcb *pcb, u32_t seqno, u32_t ackno, u16_t local_port, u16_t remote_port) { struct pbuf *p; - + p = tcp_rst_common(pcb, seqno, ackno, local_ip, remote_ip, local_port, remote_port); if (p != NULL) { tcp_output_control_segment(pcb, p, local_ip, remote_ip);