TCP: check for an active connection before cleaning it up

If there is no active connection (e.g. it is waiting in accept), then
the connection object, which doesn't yet exist, should not be cleaned
up when the socket is closed.
This commit is contained in:
Andrew Webster 2016-01-22 16:22:09 -06:00 committed by Gregory Nutt
parent 5e3023bef1
commit 49e5cc5a6f
1 changed files with 5 additions and 2 deletions

View File

@ -507,9 +507,12 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
{
nllvdbg("Lost connection: %04x\n", flags);
/* Report not connected */
if (psock->s_conn != NULL)
{
/* Report not connected */
net_lostconnection(psock, flags);
net_lostconnection(psock, flags);
}
/* Free write buffers and terminate polling */