casaroli commented on code in PR #22441:
URL: https://github.com/apache/nuttx/pull/22441#discussion_r4730830348
##########
net/tcp/tcp_getsockopt.c:
##########
@@ -213,9 +216,12 @@ int tcp_getsockopt(FAR struct socket *psock, int option,
{
FAR int *nodelay = (FAR int *)value;
- /* Always true here since we do not support Nagle. */
+ /* TCP_NODELAY is always on (no Nagle algorithm). TCP_CORK is
+ * only a hint: report what setsockopt() stored.
+ */
- *nodelay = option == TCP_NODELAY ? 1 : 0;
+ *nodelay = option == TCP_NODELAY ? 1 :
+ _SO_GETOPT(conn->sconn.s_options, option);
Review Comment:
TCP_NODELAY is bit 11, which is also SO_SNDTIMEO since aa86cb99193
(__SO_PROTOCOL is 11, not 12): setsockopt(SO_SNDTIMEO) with a timeout clears
that bit (net/socket/setsockopt.c:123), so getsockopt(TCP_NODELAY) would then
give 0. The IP, IPv6 and TCP levels also share bits: TCP_CORK is the bit of
IPV6_MULTICAST_LOOP. Do you prefer that we change s_options so that no two
options share a bit, with named flags per level as Linux does (for example
tcp_sock->nonagle)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]