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
|
completes and NBUSYBKS > 0, the NBUSYBK is interrupt is enabled and the
|
||||||
operations are deferred until NBUSYBKS is truly zero (2016-03-17).
|
operations are deferred until NBUSYBKS is truly zero (2016-03-17).
|
||||||
* net/tcp/tcp_timer.c: Fix some logic when there are multiple network
|
* 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).
|
processed when the poll from the correct device is received (2016-03-20).
|
||||||
|
|
||||||
|
@ -81,37 +81,43 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn)
|
|||||||
{
|
{
|
||||||
uint16_t result;
|
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)
|
if ((conn->tcpstateflags & TCP_STATE_MASK) == TCP_ESTABLISHED)
|
||||||
{
|
{
|
||||||
/* Set up for the callback. We can't know in advance if the application
|
#ifdef CONFIG_NETDEV_MULTINIC
|
||||||
* is going to send a IPv4 or an IPv6 packet, so this setup may not
|
/* The TCP connection is established and, hence, should be bound
|
||||||
* actually be used.
|
* to a device. Make sure that the polling device is the one that
|
||||||
|
* we are bound to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_IPv4)
|
DEBUGASSERT(conn->dev != NULL);
|
||||||
tcp_ipv4_select(dev);
|
if (dev != conn->dev)
|
||||||
#else /* if defined(CONFIG_NET_IPv6) */
|
|
||||||
tcp_ipv6_select(dev);
|
|
||||||
#endif
|
#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.
|
||||||
|
*/
|
||||||
|
|
||||||
dev->d_len = 0;
|
#if defined(CONFIG_NET_IPv4)
|
||||||
dev->d_sndlen = 0;
|
tcp_ipv4_select(dev);
|
||||||
|
#else /* if defined(CONFIG_NET_IPv6) */
|
||||||
|
tcp_ipv6_select(dev);
|
||||||
|
#endif
|
||||||
|
/* Perform the callback */
|
||||||
|
|
||||||
/* Perform the callback */
|
result = tcp_callback(dev, conn, TCP_POLL);
|
||||||
|
|
||||||
result = tcp_callback(dev, conn, TCP_POLL);
|
/* Handle the callback response */
|
||||||
|
|
||||||
/* Handle the callback response */
|
tcp_appsend(dev, conn, result);
|
||||||
|
}
|
||||||
tcp_appsend(dev, conn, result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Nothing to do for this connection */
|
|
||||||
|
|
||||||
dev->d_len = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user