mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
net/inet: move socket flags into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
1b0f85c5bc
commit
99cde13a11
@@ -401,11 +401,11 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
|
||||
*/
|
||||
|
||||
DEBUGASSERT(psock != NULL);
|
||||
if (_SS_ISCONNECTED(psock->s_flags))
|
||||
if (_SS_ISCONNECTED(conn->sconn.s_flags))
|
||||
{
|
||||
/* Report the disconnection event to all socket clones */
|
||||
|
||||
tcp_lost_connection(psock, sinfo->s_cb, flags);
|
||||
tcp_lost_connection(conn, sinfo->s_cb, flags);
|
||||
}
|
||||
|
||||
/* Report not connected to the sender */
|
||||
@@ -730,18 +730,18 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf,
|
||||
return (ssize_t)-EBADF;
|
||||
}
|
||||
|
||||
/* Get the underlying TCP connection structure */
|
||||
|
||||
conn = (FAR struct tcp_conn_s *)psock->s_conn;
|
||||
|
||||
/* Make sure that this is a connected TCP socket */
|
||||
|
||||
if (psock->s_type != SOCK_STREAM || !_SS_ISCONNECTED(psock->s_flags))
|
||||
if (psock->s_type != SOCK_STREAM || !_SS_ISCONNECTED(conn->sconn.s_flags))
|
||||
{
|
||||
nerr("ERROR: Not connected\n");
|
||||
return (ssize_t)-ENOTCONN;
|
||||
}
|
||||
|
||||
/* Get the underlying TCP connection structure */
|
||||
|
||||
conn = (FAR struct tcp_conn_s *)psock->s_conn;
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
/* Ignore if not IPv6 domain */
|
||||
|
||||
|
||||
@@ -293,8 +293,8 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock,
|
||||
*/
|
||||
|
||||
ret = sixlowpan_send(dev,
|
||||
&conn->list,
|
||||
&conn->list_tail,
|
||||
&conn->sconn.list,
|
||||
&conn->sconn.list_tail,
|
||||
(FAR const struct ipv6_hdr_s *)&ipv6udp,
|
||||
buf, buflen, &destmac,
|
||||
_SO_TIMEOUT(psock->s_sndtimeo));
|
||||
@@ -349,19 +349,19 @@ ssize_t psock_6lowpan_udp_send(FAR struct socket *psock, FAR const void *buf,
|
||||
return (ssize_t)-EBADF;
|
||||
}
|
||||
|
||||
/* Get the underlying UDP "connection" structure */
|
||||
|
||||
conn = (FAR struct udp_conn_s *)psock->s_conn;
|
||||
|
||||
/* Was the UDP socket connected via connect()? */
|
||||
|
||||
if (psock->s_type != SOCK_DGRAM || !_SS_ISCONNECTED(psock->s_flags))
|
||||
if (psock->s_type != SOCK_DGRAM || !_SS_ISCONNECTED(conn->sconn.s_flags))
|
||||
{
|
||||
/* No, then it is not legal to call send() with this socket. */
|
||||
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
/* Get the underlying UDP "connection" structure */
|
||||
|
||||
conn = (FAR struct udp_conn_s *)psock->s_conn;
|
||||
|
||||
/* Ignore if not IPv6 domain */
|
||||
|
||||
if (conn->domain != PF_INET6)
|
||||
|
||||
Reference in New Issue
Block a user