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:
parent
dcbad62fef
commit
6978446b8e
@ -310,10 +310,6 @@ struct tcp_conn_s
|
|||||||
/* Callback instance for TCP send() */
|
/* Callback instance for TCP send() */
|
||||||
|
|
||||||
FAR struct devif_callback_s *sndcb;
|
FAR struct devif_callback_s *sndcb;
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_ASSERTIONS
|
|
||||||
int sndcb_alloc_cnt; /* The callback allocation counter */
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* accept() is called when the TCP logic has created a connection
|
/* accept() is called when the TCP logic has created a connection
|
||||||
|
@ -1182,21 +1182,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
|
|||||||
{
|
{
|
||||||
conn->sndcb = tcp_callback_alloc(conn);
|
conn->sndcb = tcp_callback_alloc(conn);
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_ASSERTIONS
|
|
||||||
if (conn->sndcb != NULL)
|
|
||||||
{
|
|
||||||
conn->sndcb_alloc_cnt++;
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Test if the callback has been allocated */
|
/* Test if the callback has been allocated */
|
||||||
|
|
||||||
if (conn->sndcb == NULL)
|
if (conn->sndcb == NULL)
|
||||||
@ -1207,6 +1192,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
|
|||||||
ret = nonblock ? -EAGAIN : -ENOMEM;
|
ret = nonblock ? -EAGAIN : -ENOMEM;
|
||||||
goto errout_with_lock;
|
goto errout_with_lock;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Set up the callback in the connection */
|
/* Set up the callback in the connection */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user