Fix an error introduced in last commit.

This commit is contained in:
Gregory Nutt 2017-10-19 16:26:09 -06:00
parent 5a416be95b
commit 7d62a74915

View File

@ -396,6 +396,8 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
else if ((flags & TCP_DISCONN_EVENTS) != 0)
{
FAR struct socket *psock = pstate->snd_sock;
ninfo("Lost connection\n");
/* We could get here recursively through the callback actions of
@ -403,11 +405,12 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
* already been disconnected.
*/
DEBUGASSERT(psock != NULL);
if (_SS_ISCONNECTED(psock->s_flags))
{
/* Report not connected */
tcp_lost_connection(pstate->snd_sock, pstate->snd_cb, flags);
tcp_lost_connection(psock, pstate->snd_cb, flags);
}
pstate->snd_sent = -ENOTCONN;