On SDK develop I was deadlocks when downloading large (2MB) files via HTTPS. It seems that the default TCP WND is too small. The following patch seems to avoid the deadlock.
N.B The PBUF_POOL_SIZE might not be essential though
--- a/test/lwipopts.h
+++ b/test/lwipopts.h
@@ -8,7 +8,7 @@
#define MEM_SIZE 8000
#define MEMP_NUM_TCP_SEG 32
#define MEMP_NUM_ARP_QUEUE 10
-#define PBUF_POOL_SIZE 24
+#define PBUF_POOL_SIZE 28
#define LWIP_ARP 1
#define LWIP_ETHERNET 1
#define LWIP_ICMP 1
@@ -80,9 +80,12 @@
#define SLIP_DEBUG LWIP_DBG_OFF
#define DHCP_DEBUG LWIP_DBG_OFF
-/* TCP WND must be at least 16 kb to match TLS record size
- or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */
-#define TCP_WND 16384
+/* TCP_WND must be strictly greater than the maximum raw TLS record size.
+ A 16384-byte plaintext TLS record expands to ~16413 raw bytes (+ header/nonce/auth tag).
+ Setting TCP_WND == 16384 deadlocks: the server fills the window before mbedTLS can
+ complete the record, so altcp_recved is never called and rcv_wnd stays at 0.
+ Use 2x to allow one record in flight while the previous one is being acked. */
+#define TCP_WND 32768
#define LWIP_ALTCP 1
#define LWIP_ALTCP_TLS
On SDK develop I was deadlocks when downloading large (2MB) files via HTTPS. It seems that the default TCP WND is too small. The following patch seems to avoid the deadlock.
N.B The PBUF_POOL_SIZE might not be essential though