net/inet: move socket linger into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
3fce144aeb
commit
9317626c32
5 changed files with 7 additions and 12 deletions
|
@ -240,6 +240,9 @@ struct socket_conn_s
|
|||
sockopt_t s_options; /* Selected socket options */
|
||||
socktimeo_t s_rcvtimeo; /* Receive timeout value (in deciseconds) */
|
||||
socktimeo_t s_sndtimeo; /* Send timeout value (in deciseconds) */
|
||||
#ifdef CONFIG_NET_SOLINGER
|
||||
socktimeo_t s_linger; /* Linger timeout value (in deciseconds) */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Connection-specific content may follow */
|
||||
|
@ -260,9 +263,6 @@ struct socket
|
|||
/* Socket options */
|
||||
|
||||
#ifdef CONFIG_NET_SOCKOPTS
|
||||
#ifdef CONFIG_NET_SOLINGER
|
||||
socktimeo_t s_linger; /* Linger timeout value (in deciseconds) */
|
||||
#endif
|
||||
#ifdef CONFIG_NET_TIMESTAMP
|
||||
int32_t s_timestamp; /* Socket timestamp enabled/disabled */
|
||||
#endif
|
||||
|
|
|
@ -77,11 +77,6 @@ int psock_dup2(FAR struct socket *psock1, FAR struct socket *psock2)
|
|||
psock2->s_domain = psock1->s_domain; /* IP domain: PF_INET, PF_INET6, or PF_PACKET */
|
||||
psock2->s_type = psock1->s_type; /* Protocol type: Only SOCK_STREAM or SOCK_DGRAM */
|
||||
psock2->s_sockif = psock1->s_sockif; /* Socket interface */
|
||||
#ifdef CONFIG_NET_SOCKOPTS
|
||||
#ifdef CONFIG_NET_SOLINGER
|
||||
psock2->s_linger = psock1->s_linger; /* Linger timeout value (in deciseconds) */
|
||||
#endif
|
||||
#endif
|
||||
psock2->s_conn = psock1->s_conn; /* UDP or TCP connection structure */
|
||||
|
||||
/* Increment the reference count on the underlying connection structure
|
||||
|
|
|
@ -363,12 +363,12 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
|
|||
if (setting->l_onoff)
|
||||
{
|
||||
_SO_SETOPT(conn->s_options, option);
|
||||
psock->s_linger = 10 * setting->l_linger;
|
||||
conn->s_linger = 10 * setting->l_linger;
|
||||
}
|
||||
else
|
||||
{
|
||||
_SO_CLROPT(conn->s_options, option);
|
||||
psock->s_linger = 0;
|
||||
conn->s_linger = 0;
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
|
|
|
@ -285,7 +285,7 @@ static inline int tcp_close_disconnect(FAR struct socket *psock)
|
|||
{
|
||||
/* Wait until for the buffered TX data to be sent. */
|
||||
|
||||
ret = tcp_txdrain(psock, _SO_TIMEOUT(psock->s_linger));
|
||||
ret = tcp_txdrain(psock, _SO_TIMEOUT(conn->sconn.s_linger));
|
||||
if (ret < 0)
|
||||
{
|
||||
/* tcp_txdrain may fail, but that won't stop us from closing
|
||||
|
|
|
@ -89,7 +89,7 @@ int udp_close(FAR struct socket *psock)
|
|||
|
||||
if (_SO_GETOPT(conn->sconn.s_options, SO_LINGER))
|
||||
{
|
||||
timeout = _SO_TIMEOUT(psock->s_linger);
|
||||
timeout = _SO_TIMEOUT(conn->sconn.s_linger);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue