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
80bfe13b54
commit
83f7c08f65
@ -139,8 +139,20 @@ int tcp_getsockopt(FAR struct socket *psock, int option,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TCP_NODELAY: /* Avoid coalescing of small segments. */
|
case TCP_NODELAY: /* Avoid coalescing of small segments. */
|
||||||
nerr("ERROR: TCP_NODELAY not supported\n");
|
if (*value_len < sizeof(int))
|
||||||
ret = -ENOSYS;
|
{
|
||||||
|
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;
|
break;
|
||||||
|
|
||||||
case TCP_KEEPIDLE: /* Start keepalives after this IDLE period */
|
case TCP_KEEPIDLE: /* Start keepalives after this IDLE period */
|
||||||
|
@ -133,8 +133,24 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TCP_NODELAY: /* Avoid coalescing of small segments. */
|
case TCP_NODELAY: /* Avoid coalescing of small segments. */
|
||||||
nerr("ERROR: TCP_NODELAY not supported\n");
|
if (value_len != sizeof(int))
|
||||||
ret = -ENOSYS;
|
{
|
||||||
|
ret = -EDOM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int nodelay = *(FAR int *)value;
|
||||||
|
|
||||||
|
if (nodelay)
|
||||||
|
{
|
||||||
|
ret = OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nerr("ERROR: TCP_NODELAY not supported\n");
|
||||||
|
ret = -ENOSYS;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TCP_KEEPIDLE: /* Start keepalives after this IDLE period */
|
case TCP_KEEPIDLE: /* Start keepalives after this IDLE period */
|
||||||
|
Loading…
Reference in New Issue
Block a user