From a22e3dd34c83700f58e698704d94d98f8c580ed9 Mon Sep 17 00:00:00 2001 From: Marco Leise Date: Wed, 5 Jul 2017 19:45:12 +0200 Subject: [PATCH] Provide backlog for socket.listen() `listen(0)` in general means that you can't connect to the server at all. That it still works is at least in parts due to SYN cookies being enabled in most Linux systems. These allow connections even if an attacker spams the server with unacknowledged connection requests thereby filling up the backlog. Being behind a firewall/router I have this disabled in the kernel and witness the 'proper' socket behavior: The client waits for the server to make room in its size 0 backlog until the TCP timeout happens. Both enabling SYN cookies and raising the backlog to at least 1 makes it work. Since DCD works purely on the loopback network which seems to accept connections synchronous on Linux at least, a value of 1 is probably all that's technically required, but some larger number (32) wont do any harm. --- src/server/main.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/main.d b/src/server/main.d index 05b983c..6c9be84 100644 --- a/src/server/main.d +++ b/src/server/main.d @@ -156,7 +156,7 @@ int main(string[] args) info("Listening at ", socketFile); } } - socket.listen(0); + socket.listen(32); scope (exit) {