Skip to content

Commit

Permalink
Implment SO_ACCEPTCONN
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiang781216 authored and gregory-nutt committed Jan 31, 2020
1 parent cf2ddbb commit 7e67add
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion net/socket/getsockopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,

switch (option)
{
case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */
if (*value_len < sizeof(int))
{
return -EINVAL;
}

*(FAR int *)value = _SS_ISLISTENING(psock->s_flags);
*value_len = sizeof(int);
break;

/* The following options take a point to an integer boolean value.
* We will blindly report the bit here although the implementation
* is outside of the scope of getsockopt.
Expand Down Expand Up @@ -268,7 +278,6 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,

/* The following are not yet implemented (return values other than {0,1) */

case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */
case SO_LINGER: /* Lingers on a close() if data is present */
case SO_RCVBUF: /* Sets receive buffer size */
case SO_RCVLOWAT: /* Sets the minimum number of bytes to input */
Expand Down

0 comments on commit 7e67add

Please sign in to comment.