mirror of
https://github.com/apache/nuttx.git
synced 2026-08-20 21:18:23 +00:00
net/tcp: only print the error when disable the TCP_NODELAY
Since we do not have the Nagle's algorithm, the TCP_NODELAY socket option is enabled by default. Change-Id: I0c8619bb06cf418f7eded5bd72ac512b349cacc5 Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
4e77f7cf9f
commit
043c92fedd
2 changed files with 32 additions and 4 deletions
|
|
@ -154,8 +154,20 @@ int tcp_getsockopt(FAR struct socket *psock, int option,
|
|||
break;
|
||||
|
||||
case TCP_NODELAY: /* Avoid coalescing of small segments. */
|
||||
nerr("ERROR: TCP_NODELAY not supported\n");
|
||||
ret = -ENOSYS;
|
||||
if (*value_len < sizeof(int))
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
FAR int *nodelay = (FAR int *)value;
|
||||
|
||||
/* Always true here since we do not support Nagle. */
|
||||
|
||||
*nodelay = 1;
|
||||
*value_len = sizeof(int);
|
||||
ret = OK;
|
||||
}
|
||||
break;
|
||||
|
||||
case TCP_KEEPIDLE: /* Start keepalives after this IDLE period */
|
||||
|
|
|
|||
|
|
@ -148,8 +148,24 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
|
|||
break;
|
||||
|
||||
case TCP_NODELAY: /* Avoid coalescing of small segments. */
|
||||
nerr("ERROR: TCP_NODELAY not supported\n");
|
||||
ret = -ENOSYS;
|
||||
if (value_len != sizeof(int))
|
||||
{
|
||||
ret = -EDOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
int nodelay = *(FAR int *)value;
|
||||
|
||||
if (nodelay)
|
||||
{
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
nerr("ERROR: TCP_NODELAY not supported\n");
|
||||
ret = -ENOSYS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TCP_KEEPIDLE: /* Start keepalives after this IDLE period */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue