From 0b2a652317951c86b3af15ff99452aa48d1f2ffa Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 17 Apr 2017 20:41:13 +0800 Subject: [PATCH] api_msg: Use lwip_netconn_is_err_msg instead of NULL test in netconn_drain() The NULL test no longer work after commit e0a2472706ee, it needs to test with lwip_netconn_is_err_msg() instead. Fixes: e0a2472706ee ("netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received") Signed-off-by: Axel Lin --- src/api/api_msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 063da344..fa6ced1a 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -816,7 +816,8 @@ netconn_drain(struct netconn *conn) while (sys_mbox_tryfetch(&conn->recvmbox, &mem) != SYS_MBOX_EMPTY) { #if LWIP_TCP if (NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP) { - if (mem != NULL) { + err_t err; + if (lwip_netconn_is_err_msg(mem, &err) == 0) { p = (struct pbuf*)mem; /* pcb might be set to NULL already by err_tcp() */ if (conn->pcb.tcp != NULL) {