mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
Networking: Fix race condition that can cause missing loss-of-connection events. From Max Holtzberg
This commit is contained in:
parent
fb37248343
commit
abc006453f
2 changed files with 14 additions and 0 deletions
|
|
@ -5502,4 +5502,7 @@
|
|||
changes made to pl2303, but untested (2013-9-5).
|
||||
* arch/arm/src/sama5/sam_udphs.c: The high-speed device side driver
|
||||
is now functional (although more testing is always needed) (2013-9-5).
|
||||
* net/net_monitor.c: Fixes a race condition where a loss of connection
|
||||
may not be detected when the connection is lost before it has been
|
||||
accepted (from Max Holtzberg) (2013-9-6).
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,17 @@ int net_startmonitor(FAR struct socket *psock)
|
|||
|
||||
conn->connection_private = (void*)psock;
|
||||
conn->connection_event = connection_event;
|
||||
|
||||
/* Check if the connection has already been closed before any callbacks have
|
||||
* been registered. (Maybe the connection is lost before accept has registered
|
||||
* the monitoring callback.)
|
||||
*/
|
||||
|
||||
if (conn->tcpstateflags == UIP_CLOSED)
|
||||
{
|
||||
connection_event(conn, UIP_CLOSE);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue