mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
net/tcp: fix the problem of nested tx in the rxcb process
since the current txnotify is executed synchronously at the location of the current call without switching threads, resources such as d_iob need to be cached first. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
@@ -602,6 +602,18 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
|
|
||||||
if ((flags & TCP_NEWDATA) != 0)
|
if ((flags & TCP_NEWDATA) != 0)
|
||||||
{
|
{
|
||||||
|
FAR uint8_t *buf = dev->d_buf;
|
||||||
|
FAR uint8_t *appdata = dev->d_appdata;
|
||||||
|
uint16_t len = dev->d_len;
|
||||||
|
#ifdef CONFIG_NET_TCPURGDATA
|
||||||
|
FAR uint8_t *urgdata = dev->d_urgdata;
|
||||||
|
uint16_t urglen = dev->d_urglen;
|
||||||
|
#endif
|
||||||
|
FAR struct iob_s *iob = dev->d_iob;
|
||||||
|
|
||||||
|
dev->d_buf = NULL;
|
||||||
|
dev->d_iob = NULL;
|
||||||
|
|
||||||
/* The current receive data needs to be handled by
|
/* The current receive data needs to be handled by
|
||||||
* following tcp_recvhandler or tcp_data_event. Notify
|
* following tcp_recvhandler or tcp_data_event. Notify
|
||||||
* driver to send the message and marked as rexmit
|
* driver to send the message and marked as rexmit
|
||||||
@@ -609,7 +621,16 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
|
|
||||||
TCP_WBNACK(wrb) = 0;
|
TCP_WBNACK(wrb) = 0;
|
||||||
conn->timeout = true;
|
conn->timeout = true;
|
||||||
|
|
||||||
netdev_txnotify_dev(conn->dev);
|
netdev_txnotify_dev(conn->dev);
|
||||||
|
netdev_iob_replace(dev, iob);
|
||||||
|
dev->d_buf = buf;
|
||||||
|
dev->d_appdata = appdata;
|
||||||
|
dev->d_len = len;
|
||||||
|
#ifdef CONFIG_NET_TCPURGDATA
|
||||||
|
dev->d_urgdata = urgdata;
|
||||||
|
dev->d_urglen = urglen;
|
||||||
|
#endif
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user