diff --git a/doc/guide.html b/doc/guide.html
index 86eb74c45..8346c80b3 100644
--- a/doc/guide.html
+++ b/doc/guide.html
@@ -700,6 +700,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 ef950647e..e8f8fad2f 100644
--- a/doc/guide.tex
+++ b/doc/guide.tex
@@ -838,6 +838,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/doc/release_notes_2.1.0.txt b/doc/release_notes_2.1.0.txt
index 7837a918d..1a68682e0 100644
--- a/doc/release_notes_2.1.0.txt
+++ b/doc/release_notes_2.1.0.txt
@@ -43,6 +43,7 @@
* Configuration
- Added option access_max_user_messages for mod_offline
+- Added option backlog for ejabberd_listener to increase TCP backlog
- Added option define_macro and use_macro
- Added option include_config_file to include additional configuration files
- Added option max_fsm_queue
diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl
index dad7aa5be..7d5ca2fa8 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 ->