diff --git a/net/tcp/tcp_getsockopt.c b/net/tcp/tcp_getsockopt.c index 5284716d2b1..e3cbdf7f0c8 100644 --- a/net/tcp/tcp_getsockopt.c +++ b/net/tcp/tcp_getsockopt.c @@ -133,23 +133,6 @@ int tcp_getsockopt(FAR struct socket *psock, int option, } break; - case TCP_NODELAY: /* Avoid coalescing of small segments. */ - 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 */ case TCP_KEEPINTVL: /* Interval between keepalives */ { @@ -218,6 +201,23 @@ int tcp_getsockopt(FAR struct socket *psock, int option, break; #endif /* CONFIG_NET_TCP_KEEPALIVE */ + case TCP_NODELAY: /* Avoid coalescing of small segments. */ + 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_MAXSEG: /* The maximum segment size */ if (*value_len < sizeof(int)) { diff --git a/net/tcp/tcp_setsockopt.c b/net/tcp/tcp_setsockopt.c index fdbb58df930..ba2bdf6522a 100644 --- a/net/tcp/tcp_setsockopt.c +++ b/net/tcp/tcp_setsockopt.c @@ -130,23 +130,6 @@ int tcp_setsockopt(FAR struct socket *psock, int option, } break; - case TCP_NODELAY: /* Avoid coalescing of small segments. */ - if (value_len != sizeof(int)) - { - ret = -EDOM; - } - else - { - int nodelay = *(FAR int *)value; - - if (!nodelay) - { - nerr("ERROR: TCP_NODELAY not supported\n"); - ret = -ENOSYS; - } - } - break; - case TCP_KEEPIDLE: /* Start keepalives after this IDLE period */ case TCP_KEEPINTVL: /* Interval between keepalives */ { @@ -230,6 +213,23 @@ int tcp_setsockopt(FAR struct socket *psock, int option, break; #endif /* CONFIG_NET_TCP_KEEPALIVE */ + case TCP_NODELAY: /* Avoid coalescing of small segments. */ + if (value_len != sizeof(int)) + { + ret = -EDOM; + } + else + { + int nodelay = *(FAR int *)value; + + if (!nodelay) + { + nerr("ERROR: TCP_NODELAY not supported\n"); + ret = -ENOSYS; + } + } + break; + case TCP_MAXSEG: /* The maximum segment size */ if (value_len != sizeof(int)) {