diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index f857a835d6..6637e46ac0 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -388,6 +388,17 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, 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 */ if ((flags & TCP_DISCONN_EVENTS) != 0) diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index 000a2a3093..03ce11ea94 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -207,6 +207,17 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev, ninfo("flags: %04x acked: %" PRId32 " sent: %zd\n", 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 * acknowledged bytes. * This condition is located here for performance reasons diff --git a/net/tcp/tcp_sendfile.c b/net/tcp/tcp_sendfile.c index f2e21ce206..da35529848 100644 --- a/net/tcp/tcp_sendfile.c +++ b/net/tcp/tcp_sendfile.c @@ -199,6 +199,17 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev, ninfo("flags: %04x acked: %" PRId32 " sent: %zd\n", 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 * acknowledged bytes. * This condition is located here for performance reasons