From 227514c20c309522debe437b894d5409cb8363bf Mon Sep 17 00:00:00 2001
From: Badlop
Date: Mon, 19 Oct 2009 13:24:13 +0000
Subject: [PATCH] Support ejabberd_listener option 'backlog' to increase TCP
backlog (thanks to Janusz Dziemidowicz)(EJAB-1063)
SVN Revision: 2679
---
doc/guide.html | 6 ++++++
doc/guide.tex | 6 ++++++
src/ejabberd_listener.erl | 1 +
3 files changed, 13 insertions(+)
diff --git a/doc/guide.html b/doc/guide.html
index ca79772d5..60d233f43 100644
--- a/doc/guide.html
+++ b/doc/guide.html
@@ -690,6 +690,12 @@ Handles incoming HTTP connections.
-
{access, AccessName}
- This option defines
access to the port. The default value is all.
+
- {backlog, Value}
- The backlog value
+defines the maximum length that the queue of pending connections may
+grow to. This should be increased if the server is going to handle
+lots of new incoming connections as they may be dropped if there is
+no space in the queue (and ejabberd was not able to accept them
+immediately). Default value is 5.
- {certfile, Path}
- Full path to a file containing the default SSL certificate.
To define a certificate file specific for a given domain, use the global option domain_certfile.
- {service_check_from, true|false}
-
diff --git a/doc/guide.tex b/doc/guide.tex
index 4a34e4601..2f3c2171a 100644
--- a/doc/guide.tex
+++ b/doc/guide.tex
@@ -823,6 +823,12 @@ This is a detailed description of each option allowed by the listening modules:
\begin{description}
\titem{\{access, AccessName\}} \ind{options!access}This option defines
access to the port. The default value is \term{all}.
+ \titem{\{backlog, Value\}} \ind{options!backlog}The backlog value
+ defines the maximum length that the queue of pending connections may
+ grow to. This should be increased if the server is going to handle
+ lots of new incoming connections as they may be dropped if there is
+ no space in the queue (and ejabberd was not able to accept them
+ immediately). Default value is 5.
\titem{\{certfile, Path\}} Full path to a file containing the default SSL certificate.
To define a certificate file specific for a given domain, use the global option \term{domain\_certfile}.
\titem{\{service\_check\_from, true|false\}} \ind{options!service\_check\_from}
diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl
index 26167351f..fa1209626 100644
--- a/src/ejabberd_listener.erl
+++ b/src/ejabberd_listener.erl
@@ -104,6 +104,7 @@ init(PortIP, Module, RawOpts) ->
SockOpts = lists:filter(fun({ip, _}) -> true;
(inet6) -> true;
(inet) -> true;
+ ({backlog, _}) -> true;
(_) -> false
end, Opts),
if Proto == udp ->