From 60e9f08e47abf9f79a3f218bf94311aa7d1da944 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Fri, 16 May 2025 13:34:15 +0100 Subject: [PATCH] LwIP: Fix TCP support --- include/coap3/coap_pdu_internal.h | 2 +- src/coap_session.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/coap3/coap_pdu_internal.h b/include/coap3/coap_pdu_internal.h index 9b359129..0bb140be 100644 --- a/include/coap3/coap_pdu_internal.h +++ b/include/coap3/coap_pdu_internal.h @@ -75,7 +75,7 @@ #ifndef COAP_DEFAULT_MAX_PDU_RX_SIZE #if defined(WITH_LWIP) -#define COAP_DEFAULT_MAX_PDU_RX_SIZE (COAP_MAX_MESSAGE_SIZE_TCP16+4UL) +#define COAP_DEFAULT_MAX_PDU_RX_SIZE (COAP_MAX_MESSAGE_SIZE_TCP16+6UL) #elif defined(WITH_CONTIKI) #define COAP_DEFAULT_MAX_PDU_RX_SIZE (UIP_APPDATA_SIZE) #elif (UINT_MAX < (8UL*1024*1024+256)) diff --git a/src/coap_session.c b/src/coap_session.c index 541b050c..2225dc47 100644 --- a/src/coap_session.c +++ b/src/coap_session.c @@ -2053,6 +2053,8 @@ coap_new_client_session_pki_lkd(coap_context_t *ctx, coap_session_t * coap_new_server_session(coap_context_t *ctx, coap_endpoint_t *ep, void *extra) { coap_session_t *session; + coap_tick_t now; + session = coap_make_session(ep->proto, COAP_SESSION_TYPE_SERVER, NULL, NULL, NULL, 0, ctx, ep); if (!session) @@ -2072,6 +2074,8 @@ coap_new_server_session(coap_context_t *ctx, coap_endpoint_t *ep, void *extra) { #endif /* COAP_EPOLL_SUPPORT */ SESSIONS_ADD(ep->sessions, session); if (session) { + coap_ticks(&now); + session->last_rx_tx = now; coap_log_debug("***%s: session %p: new incoming session\n", coap_session_str(session), (void *)session); coap_handle_event_lkd(session->context, COAP_EVENT_TCP_CONNECTED, session);