INN commit: trunk (configure.ac doc/pod/news.pod nnrpd/nnrpd.c)
INN Commit
rra at isc.org
Mon Mar 28 17:38:48 UTC 2016
Date: Monday, March 28, 2016 @ 10:38:48
Author: iulius
Revision: 9985
nnrpd: keep TCP_NODELAY only for BSD/OS systems
Fixed slow nnrpd responses for a few NNTP commands. The TCP_NODELAY
option was unconditionally set whereas only BSD/OS systems needed it.
Modern networking stacks do not need such tweaks.
Thanks to Christian Mock for having discovered that.
Modified:
trunk/configure.ac
trunk/doc/pod/news.pod
trunk/nnrpd/nnrpd.c
------------------+
configure.ac | 6 ++++++
doc/pod/news.pod | 6 ++++++
nnrpd/nnrpd.c | 11 ++++++++---
3 files changed, 20 insertions(+), 3 deletions(-)
Modified: configure.ac
===================================================================
--- configure.ac 2016-01-31 13:15:30 UTC (rev 9984)
+++ configure.ac 2016-03-28 17:38:48 UTC (rev 9985)
@@ -203,6 +203,12 @@
[Define if compiling on Linux to get prototypes for some functions.])
;;
+dnl Detect BSD/OS for later use in nnrpd code.
+*-bsdi*)
+ AC_DEFINE([INN_BSDI_HOST], [1],
+ [Define if compiling on BSD/OS systems.])
+ ;;
+
dnl HP-UX's native compiler needs a special flag to turn on ANSI, and needs
dnl -g on link as well as compile for debugging to work.
*hpux*)
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2016-01-31 13:15:30 UTC (rev 9984)
+++ doc/pod/news.pod 2016-03-28 17:38:48 UTC (rev 9985)
@@ -26,6 +26,12 @@
=item *
+Fixed slow B<nnrpd> responses for a few NNTP commands. The TCP_NODELAY
+option was unconditionally set whereas only BSD/OS systems needed it.
+Thanks to Christian Mock for having discovered that.
+
+=item *
+
When an encryption layer is negotiated during a successful use of the
STARTTLS command, or after a successful authentication using a SASL
mechanism which negotiates an encryption layer, B<nnrpd> now updates
Modified: nnrpd/nnrpd.c
===================================================================
--- nnrpd/nnrpd.c 2016-01-31 13:15:30 UTC (rev 9984)
+++ nnrpd/nnrpd.c 2016-03-28 17:38:48 UTC (rev 9985)
@@ -13,7 +13,9 @@
#include "portable/socket.h"
#include <netdb.h>
#include <signal.h>
-#include <netinet/tcp.h>
+#if defined(INN_BSDI_HOST)
+# include <netinet/tcp.h>
+#endif
#if HAVE_GETSPNAM
# include <shadow.h>
@@ -579,7 +581,6 @@
struct sockaddr *sas = (struct sockaddr *) &sss;
socklen_t length;
size_t size;
- int nodelay = 1;
memset(&Client, 0, sizeof(Client));
strlcpy(Client.host, "?", sizeof(Client.host));
@@ -648,9 +649,13 @@
Client.serverport = network_sockaddr_port(sas);
}
+#if defined(INN_BSDI_HOST)
/* Setting TCP_NODELAY to nnrpd fixes a problem of slow downloading
- * of overviews and slow answers on some architectures (like BSD/OS). */
+ * of overviews and slow answers on some architectures (like BSD/OS
+ * where TCP delayed acknowledgements are enabled). */
+ int nodelay = 1;
setsockopt(STDIN_FILENO, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay));
+#endif
notice("%s (%s) connect - port %u", Client.host, Client.ip, port);
More information about the inn-committers
mailing list