fixed bug #47448 (netconn/socket leak if RST is received during close)

This commit is contained in:
sg
2016-03-17 21:49:01 +01:00
parent 93ccba9bcb
commit 149bb36805
2 changed files with 12 additions and 3 deletions

View File

@@ -378,13 +378,19 @@ err_tcp(void *arg, err_t err)
conn->pcb.tcp = NULL;
/* no check since this is always fatal! */
SYS_ARCH_SET(conn->last_err, err);
/* reset conn->state now before waking up other threads */
old_state = conn->state;
conn->state = NETCONN_NONE;
if (old_state == NETCONN_CLOSE) {
/* RST during close: let close return success & dealloc the netconn */
err = ERR_OK;
NETCONN_SET_SAFE_ERR(conn, ERR_OK);
} else {
/* no check since this is always fatal! */
SYS_ARCH_SET(conn->last_err, err);
}
/* @todo: the type of NETCONN_EVT created should depend on 'old_state' */
/* Notify the user layer about a connection error. Used to signal select. */