From db3a4e31586f8614b0a27b482406b0c212a4e08a Mon Sep 17 00:00:00 2001 From: goldsimon Date: Fri, 17 Nov 2017 21:22:53 +0100 Subject: [PATCH] socket/netconn recv: FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for netconns) --- src/api/api_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/api_lib.c b/src/api/api_lib.c index b92cf3b9..9c7b249f 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -642,8 +642,8 @@ netconn_recv_data_tcp(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags #endif /* LWIP_TCP */ if (!sys_mbox_valid(&conn->recvmbox)) { - /* This happens when calling this function after receiving FIN */ - return sys_mbox_valid(&conn->acceptmbox) ? ERR_CONN : ERR_CLSD; + /* This only happens when calling this function more than once *after* receiving FIN */ + return ERR_CONN; } if (!(apiflags & NETCONN_NOAUTORCVD)) {