Fixed bug where tearing down a connection would cause loss of memory.

This commit is contained in:
davidhaas 2003-04-09 20:12:12 +00:00
parent be7275c238
commit 0bce6f8974
2 changed files with 5 additions and 2 deletions

View File

@ -255,7 +255,7 @@ netconn_delete(struct netconn *conn)
/* Drain the recvmbox. */
if(conn->recvmbox != SYS_MBOX_NULL) {
while(sys_arch_mbox_fetch(conn->recvmbox, &mem, 1) != 0) {
while(sys_arch_mbox_fetch(conn->recvmbox, &mem, 1) != SYS_ARCH_TIMEOUT) {
if(conn->type == NETCONN_TCP) {
pbuf_free((struct pbuf *)mem);
} else {
@ -269,7 +269,7 @@ netconn_delete(struct netconn *conn)
/* Drain the acceptmbox. */
if(conn->acceptmbox != SYS_MBOX_NULL) {
while(sys_arch_mbox_fetch(conn->acceptmbox, &mem, 1) != 0) {
while(sys_arch_mbox_fetch(conn->acceptmbox, &mem, 1) != SYS_ARCH_TIMEOUT) {
netconn_delete((struct netconn *)mem);
}

View File

@ -68,6 +68,9 @@ struct sys_timeout {u8_t dummy;};
#include "arch/sys_arch.h"
/** Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait */
#define SYS_ARCH_TIMEOUT 0xffffffff
typedef void (* sys_timeout_handler)(void *arg);
struct sys_timeout {