net/tcp/tcp_send*: added debug asserts for TCP_ACKDATA, TCP_REXMIT and TCP_DISCONN_EVENTS flags

This commit is contained in:
Alexander Lunev 2022-01-18 22:51:03 +03:00 committed by Xiang Xiao
parent 8bcdefafc9
commit 6bb7a92a9a
3 changed files with 33 additions and 0 deletions

View File

@ -388,6 +388,17 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
ninfo("flags: %04x\n", flags); ninfo("flags: %04x\n", flags);
/* The TCP_ACKDATA, TCP_REXMIT and TCP_DISCONN_EVENTS flags are expected to
* appear here strictly one at a time
*/
DEBUGASSERT((flags & TCP_ACKDATA) == 0 ||
(flags & TCP_REXMIT) == 0);
DEBUGASSERT((flags & TCP_DISCONN_EVENTS) == 0 ||
(flags & TCP_ACKDATA) == 0);
DEBUGASSERT((flags & TCP_DISCONN_EVENTS) == 0 ||
(flags & TCP_REXMIT) == 0);
/* Check for a loss of connection */ /* Check for a loss of connection */
if ((flags & TCP_DISCONN_EVENTS) != 0) if ((flags & TCP_DISCONN_EVENTS) != 0)

View File

@ -207,6 +207,17 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
ninfo("flags: %04x acked: %" PRId32 " sent: %zd\n", ninfo("flags: %04x acked: %" PRId32 " sent: %zd\n",
flags, pstate->snd_acked, pstate->snd_sent); flags, pstate->snd_acked, pstate->snd_sent);
/* The TCP_ACKDATA, TCP_REXMIT and TCP_DISCONN_EVENTS flags are expected to
* appear here strictly one at a time
*/
DEBUGASSERT((flags & TCP_ACKDATA) == 0 ||
(flags & TCP_REXMIT) == 0);
DEBUGASSERT((flags & TCP_DISCONN_EVENTS) == 0 ||
(flags & TCP_ACKDATA) == 0);
DEBUGASSERT((flags & TCP_DISCONN_EVENTS) == 0 ||
(flags & TCP_REXMIT) == 0);
/* If this packet contains an acknowledgement, then update the count of /* If this packet contains an acknowledgement, then update the count of
* acknowledged bytes. * acknowledged bytes.
* This condition is located here for performance reasons * This condition is located here for performance reasons

View File

@ -199,6 +199,17 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
ninfo("flags: %04x acked: %" PRId32 " sent: %zd\n", ninfo("flags: %04x acked: %" PRId32 " sent: %zd\n",
flags, pstate->snd_acked, pstate->snd_sent); flags, pstate->snd_acked, pstate->snd_sent);
/* The TCP_ACKDATA, TCP_REXMIT and TCP_DISCONN_EVENTS flags are expected to
* appear here strictly one at a time
*/
DEBUGASSERT((flags & TCP_ACKDATA) == 0 ||
(flags & TCP_REXMIT) == 0);
DEBUGASSERT((flags & TCP_DISCONN_EVENTS) == 0 ||
(flags & TCP_ACKDATA) == 0);
DEBUGASSERT((flags & TCP_DISCONN_EVENTS) == 0 ||
(flags & TCP_REXMIT) == 0);
/* If this packet contains an acknowledgement, then update the count of /* If this packet contains an acknowledgement, then update the count of
* acknowledged bytes. * acknowledged bytes.
* This condition is located here for performance reasons * This condition is located here for performance reasons