net/tcp: remove conn check since which can not be NULL

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2023-02-02 11:41:58 +08:00
committed by Xiang Xiao
parent 4c8d244fae
commit 247b050e5f
2 changed files with 28 additions and 29 deletions
+3 -1
View File
@@ -159,7 +159,7 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
FAR void *pvpriv, uint16_t flags) FAR void *pvpriv, uint16_t flags)
{ {
struct tcp_connect_s *pstate = pvpriv; struct tcp_connect_s *pstate = pvpriv;
FAR struct tcp_conn_s *conn = pstate->tc_conn; FAR struct tcp_conn_s *conn;
ninfo("flags: %04x\n", flags); ninfo("flags: %04x\n", flags);
@@ -167,6 +167,8 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
if (pstate) if (pstate)
{ {
conn = pstate->tc_conn;
/* The following errors should be detected here (someday) /* The following errors should be detected here (someday)
* *
* ECONNREFUSED * ECONNREFUSED
-3
View File
@@ -273,8 +273,6 @@ static inline void psock_lost_connection(FAR struct tcp_conn_s *conn,
conn->sndcb->event = NULL; conn->sndcb->event = NULL;
} }
if (conn != NULL)
{
/* Free all queued write buffers */ /* Free all queued write buffers */
for (entry = sq_peek(&conn->unacked_q); entry; entry = next) for (entry = sq_peek(&conn->unacked_q); entry; entry = next)
@@ -315,7 +313,6 @@ static inline void psock_lost_connection(FAR struct tcp_conn_s *conn,
conn->tcpstateflags = TCP_CLOSED; conn->tcpstateflags = TCP_CLOSED;
} }
} }
}
/**************************************************************************** /****************************************************************************
* Name: parse_sack * Name: parse_sack