Fixed bug #29617 (sometime cause stall on delete listening connection)

This commit is contained in:
goldsimon 2010-04-21 19:59:40 +00:00
parent 49e8e28cf6
commit 51061fb61e
2 changed files with 12 additions and 1 deletions

View File

@ -182,6 +182,10 @@ HISTORY
++ Bugfixes:
2010-04-21: Simon Goldschmidt
* api_msg.c: Fixed bug #29617 (sometime cause stall on delete listening
connection)
2010-03-28: Luca Ceresoli
* ip_addr.c/.h: patch #7143: Add a few missing const qualifiers

View File

@ -694,12 +694,19 @@ netconn_drain(struct netconn *conn)
#if LWIP_TCP
if (sys_mbox_valid(&conn->acceptmbox)) {
while (sys_mbox_tryfetch(&conn->acceptmbox, &mem) != SYS_MBOX_EMPTY) {
struct netconn *newconn = (struct netconn *)mem;
/* Only tcp pcbs have an acceptmbox, so no need to check conn->type */
/* pcb might be set to NULL already by err_tcp() */
if (conn->pcb.tcp != NULL) {
tcp_accepted(conn->pcb.tcp);
}
netconn_delete((struct netconn *)mem);
/* drain recvmbox */
netconn_drain(newconn);
if (newconn->pcb.tcp != NULL) {
tcp_abort(newconn->pcb.tcp);
newconn->pcb.tcp = NULL;
}
netconn_free(newconn);
}
sys_mbox_free(&conn->acceptmbox);
sys_mbox_set_invalid(&conn->acceptmbox);