From 10edf648737e51ed017b45b56b7993004e29a457 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 22 Nov 2009 16:17:55 +0000 Subject: [PATCH] Fixed bug #27851 (TCP_EVENT_RECV(pcb, NULL,...) results in unreachable code warning) by calling tcp_recv_null if pcb->recv is null. --- src/include/lwip/tcp.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h index 3757b627..9a34872b 100644 --- a/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h @@ -489,11 +489,7 @@ err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb, if((pcb)->recv != NULL) { \ (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),(p),(err)); \ } else { \ - (ret) = ERR_OK; \ - if (p != NULL) { \ - tcp_recved((pcb), ((struct pbuf*)(p))->tot_len); \ - pbuf_free(p); \ - } \ + (ret) = tcp_recv_null(NULL, (pcb), (p), (err)); \ } \ } while (0) @@ -587,6 +583,10 @@ void tcp_zero_window_probe(struct tcp_pcb *pcb); u16_t tcp_eff_send_mss(u16_t sendmss, struct ip_addr *addr); #endif /* TCP_CALCULATE_EFF_SEND_MSS */ +#if LWIP_CALLBACK_API +err_t tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err); +#endif /* LWIP_CALLBACK_API */ + extern struct tcp_pcb *tcp_input_pcb; extern u32_t tcp_ticks;