net/tcp: remove debug counter of connect instance

Fixed by commit:

 | net: remove pvconn reference from all devif callback
 |
 | Do not use 'pvconn' argument to get the connection pointer since
 | pvconn is normally NULL for some events like NETDEV_DOWN.
 | Instead, the connection pointer can be reliably obtained from the
 | corresponding private pointer.

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2022-10-18 22:52:58 +08:00 committed by Xiang Xiao
parent dcbad62fef
commit 6978446b8e
2 changed files with 7 additions and 25 deletions

View file

@ -310,10 +310,6 @@ struct tcp_conn_s
/* Callback instance for TCP send() */
FAR struct devif_callback_s *sndcb;
#ifdef CONFIG_DEBUG_ASSERTIONS
int sndcb_alloc_cnt; /* The callback allocation counter */
#endif
#endif
/* accept() is called when the TCP logic has created a connection

View file

@ -1182,30 +1182,16 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
{
conn->sndcb = tcp_callback_alloc(conn);
#ifdef CONFIG_DEBUG_ASSERTIONS
if (conn->sndcb != NULL)
/* Test if the callback has been allocated */
if (conn->sndcb == NULL)
{
conn->sndcb_alloc_cnt++;
/* A buffer allocation error occurred */
/* The callback is allowed to be allocated only once.
* This is to catch a potential re-allocation after
* conn->sndcb was set to NULL.
*/
DEBUGASSERT(conn->sndcb_alloc_cnt == 1);
nerr("ERROR: Failed to allocate callback\n");
ret = nonblock ? -EAGAIN : -ENOMEM;
goto errout_with_lock;
}
#endif
}
/* Test if the callback has been allocated */
if (conn->sndcb == NULL)
{
/* A buffer allocation error occurred */
nerr("ERROR: Failed to allocate callback\n");
ret = nonblock ? -EAGAIN : -ENOMEM;
goto errout_with_lock;
}
/* Set up the callback in the connection */