net/tcp: fix tcp socket close timeout if loss wireless connection

In the current net stack implementation, there is no mechanism
for notifying the loss of the wireless connection, if the network
is disconnected then application sends data packets through tcp,
the tcp_timer will keep retrying fetch the ack for awhile, the
connection status will not be able to be switched timely.

Change-Id: I84d1121527edafc6ee6ad56ba164838694e7e11c
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2020-08-07 17:32:55 +08:00
committed by Xiang Xiao
parent 1e321ca032
commit d78bf36740
2 changed files with 16 additions and 2 deletions
+5
View File
@@ -105,6 +105,11 @@ int netdev_carrier_off(FAR struct net_driver_s *dev)
{
dev->d_flags &= ~IFF_RUNNING;
netlink_device_notify(dev);
/* Notify clients that the network has been taken down */
devif_dev_event(dev, NULL, NETDEV_DOWN);
return OK;
}