summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-01-29 15:51:18 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-01-29 15:51:18 +0000
commit1580c701aedeadaa2c864f81b96bb38fc5461b31 (patch)
treee6e00fd7aaf1a43643b6b9454d1137279758efbe
parent3eb19c02d792c8511ab9e9c9087093ccc872c304 (diff)
downloadrsyslog-1580c701aedeadaa2c864f81b96bb38fc5461b31.tar.gz
rsyslog-1580c701aedeadaa2c864f81b96bb38fc5461b31.tar.xz
rsyslog-1580c701aedeadaa2c864f81b96bb38fc5461b31.zip
fixed too-low listen backlog parameter
-rw-r--r--NEWS6
-rw-r--r--syslogd.c20
-rw-r--r--version.h2
3 files changed, 21 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 06ecb27c..f6dc7e6e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,10 @@
---------------------------------------------------------------------------
+Version 1.13.1 (RGer), 2007-02-xx
+- changed the listen backlog limit to a more reasonable value based on
+ the maximum number of TCP connections configurd (10% + 5) - thanks to Guy
+ Standen for the hint (actually, the limit was 5 and that was a
+ left-over from early testing).
+---------------------------------------------------------------------------
Version 1.13.0 (RGer), 2006-12-19
- added '$' as ToPos proptery replacer specifier - means "up to the
end of the string"
diff --git a/syslogd.c b/syslogd.c
index 89a6bfdd..a0d8f30b 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -1173,7 +1173,7 @@ static int create_tcp_socket(void)
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
- logerror("syslog: TCP: Unknown protocol, suspending tcp inet service.");
+ logerror("syslog: TCP: could not create socket, suspending tcp inet service.");
return fd;
}
@@ -1214,11 +1214,19 @@ static int create_tcp_socket(void)
close(fd);
return -1;
}
-
- if(listen(fd, 5) < 0) {
- logerror("listen, suspending tcp inet");
- close(fd);
- return -1;
+ if(listen(fd, TCPSESS_MAX / 10 + 5) < 0) {
+ /* If the listen fails, it most probably fails because we ask
+ * for a too-large backlog. So in this case we first set back
+ * to a fixed, reasonable, limit that should work. Only if
+ * that fails, too, we give up.
+ */
+ logerrorInt("listen with a backlog of %d failed - retrying with default of 32.",
+ TCPSESS_MAX / 10 + 5);
+ if(listen(fd, 32) < 0) {
+ logerror("listen, suspending tcp inet");
+ close(fd);
+ return -1;
+ }
}
sockTCPLstn = fd;
diff --git a/version.h b/version.h
index 3719360c..92406b23 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
#define VERSION "1.13"
-#define PATCHLEVEL "0"
+#define PATCHLEVEL "1"