diff options
Diffstat (limited to 'nuttx/net/socket/net_close.c')
-rw-r--r-- | nuttx/net/socket/net_close.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/nuttx/net/socket/net_close.c b/nuttx/net/socket/net_close.c index d58d42829..bab3958e3 100644 --- a/nuttx/net/socket/net_close.c +++ b/nuttx/net/socket/net_close.c @@ -477,16 +477,16 @@ static void local_close(FAR struct socket *psock) * be more if the socket was dup'ed). */ - if (conn->crefs <= 1) + if (conn->lc_crefs <= 1) { - conn->crefs = 0; + conn->lc_crefs = 0; local_free(conn); } else { /* No.. Just decrement the reference count */ - conn->crefs--; + conn->lc_crefs--; } } #endif /* CONFIG_NET_LOCAL */ @@ -533,32 +533,6 @@ int psock_close(FAR struct socket *psock) switch (psock->s_type) { -#ifdef CONFIG_NET_PKT - case SOCK_RAW: - { - FAR struct pkt_conn_s *conn = psock->s_conn; - - /* Is this the last reference to the connection structure (there - * could be more if the socket was dup'ed). - */ - - if (conn->crefs <= 1) - { - /* Yes... free the connection structure */ - - conn->crefs = 0; /* No more references on the connection */ - pkt_free(psock->s_conn); /* Free uIP resources */ - } - else - { - /* No.. Just decrement the reference count */ - - conn->crefs--; - } - } - break; -#endif - #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) case SOCK_STREAM: { @@ -659,6 +633,32 @@ int psock_close(FAR struct socket *psock) break; #endif +#ifdef CONFIG_NET_PKT + case SOCK_RAW: + { + FAR struct pkt_conn_s *conn = psock->s_conn; + + /* Is this the last reference to the connection structure (there + * could be more if the socket was dup'ed). + */ + + if (conn->crefs <= 1) + { + /* Yes... free the connection structure */ + + conn->crefs = 0; /* No more references on the connection */ + pkt_free(psock->s_conn); /* Free uIP resources */ + } + else + { + /* No.. Just decrement the reference count */ + + conn->crefs--; + } + } + break; +#endif + default: err = EBADF; goto errout; |