net/soerr: add new _SO_CONN_SETERRNO() macro

support so error code set from conn instance

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2022-11-24 19:15:10 +08:00
committed by Xiang Xiao
parent 6d8c28a83c
commit f2a7711ef8
4 changed files with 22 additions and 13 deletions
+1 -4
View File
@@ -165,10 +165,7 @@ static uint16_t tcp_monitor_event(FAR struct net_driver_s *dev,
/* Clear the socket error */
#ifdef CONFIG_NET_SOCKOPTS
conn->sconn.s_error = OK;
#endif
set_errno(OK);
_SO_CONN_SETERRNO(conn, OK);
/* Indicate that the socket is now connected */
+1 -4
View File
@@ -128,10 +128,7 @@ static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev,
reason = ECONNREFUSED;
}
#ifdef CONFIG_NET_SOCKOPTS
info->conn->sconn.s_error = reason;
#endif
set_errno(reason);
_SO_CONN_SETERRNO(info->conn, reason);
/* Mark that the connection has been lost */