From bc3edfb4d76d06a5d173c82a295d3770fdbeb152 Mon Sep 17 00:00:00 2001 From: David Girault Date: Tue, 1 Aug 2017 10:46:22 +0200 Subject: [PATCH] altcp_tls_mbedtls: remove "rx pbufs left at end of handshake" assert There is case where a close notify come right after the handshake and is in the same pbuf! So just handle these data like any other data. --- src/apps/altcp_tls/altcp_tls_mbedtls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apps/altcp_tls/altcp_tls_mbedtls.c b/src/apps/altcp_tls/altcp_tls_mbedtls.c index 32299036..59ec388c 100644 --- a/src/apps/altcp_tls/altcp_tls_mbedtls.c +++ b/src/apps/altcp_tls/altcp_tls_mbedtls.c @@ -284,7 +284,6 @@ altcp_mbedtls_lower_recv_process(struct altcp_pcb *conn, altcp_mbedtls_state_t * return ERR_OK; } /* If we come here, handshake succeeded. */ - LWIP_ASSERT("rx pbufs left at end of handshake", state->rx == NULL); LWIP_ASSERT("state", state->bio_bytes_read == 0); LWIP_ASSERT("state", state->bio_bytes_appl == 0); state->flags |= ALTCP_MBEDTLS_FLAGS_HANDSHAKE_DONE; @@ -292,9 +291,12 @@ altcp_mbedtls_lower_recv_process(struct altcp_pcb *conn, altcp_mbedtls_state_t * if (conn->connected) { conn->connected(conn->arg, conn, ERR_OK); } + if (state->rx) + goto pbuf_left; return ERR_OK; } else { /* handle application data */ + pbuf_left: return altcp_mbedtls_handle_rx_appldata(conn, state); } }