TCP poll: TCP poll events can really only being processed when the poll from the correct device is received.
This commit is contained in:
parent
4639cdd894
commit
00b44959ea
@ -11575,6 +11575,6 @@
|
||||
completes and NBUSYBKS > 0, the NBUSYBK is interrupt is enabled and the
|
||||
operations are deferred until NBUSYBKS is truly zero (2016-03-17).
|
||||
* net/tcp/tcp_timer.c: Fix some logic when there are multiple network
|
||||
interfaces. In this case, TCP timeout events can really only bei
|
||||
interfaces. In this case, TCP timeout events can really only being
|
||||
processed when the poll from the correct device is received (2016-03-20).
|
||||
|
||||
|
@ -81,13 +81,28 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn)
|
||||
{
|
||||
uint16_t result;
|
||||
|
||||
/* Verify that the connection is established */
|
||||
/* Discard any currently buffered data */
|
||||
|
||||
dev->d_len = 0;
|
||||
dev->d_sndlen = 0;
|
||||
|
||||
/* Verify that the connection is established. */
|
||||
|
||||
if ((conn->tcpstateflags & TCP_STATE_MASK) == TCP_ESTABLISHED)
|
||||
{
|
||||
/* Set up for the callback. We can't know in advance if the application
|
||||
* is going to send a IPv4 or an IPv6 packet, so this setup may not
|
||||
* actually be used.
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
/* The TCP connection is established and, hence, should be bound
|
||||
* to a device. Make sure that the polling device is the one that
|
||||
* we are bound to.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(conn->dev != NULL);
|
||||
if (dev != conn->dev)
|
||||
#endif
|
||||
{
|
||||
/* Set up for the callback. We can't know in advance if the
|
||||
* application is going to send a IPv4 or an IPv6 packet, so this
|
||||
* setup may not actually be used.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_NET_IPv4)
|
||||
@ -95,10 +110,6 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn)
|
||||
#else /* if defined(CONFIG_NET_IPv6) */
|
||||
tcp_ipv6_select(dev);
|
||||
#endif
|
||||
|
||||
dev->d_len = 0;
|
||||
dev->d_sndlen = 0;
|
||||
|
||||
/* Perform the callback */
|
||||
|
||||
result = tcp_callback(dev, conn, TCP_POLL);
|
||||
@ -107,11 +118,6 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn)
|
||||
|
||||
tcp_appsend(dev, conn, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nothing to do for this connection */
|
||||
|
||||
dev->d_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user