summaryrefslogtreecommitdiffstats
path: root/main/uwsgi/0003-core-socket-move-listen-queue-size-checking-to-creat.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/uwsgi/0003-core-socket-move-listen-queue-size-checking-to-creat.patch')
-rw-r--r--main/uwsgi/0003-core-socket-move-listen-queue-size-checking-to-creat.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/main/uwsgi/0003-core-socket-move-listen-queue-size-checking-to-creat.patch b/main/uwsgi/0003-core-socket-move-listen-queue-size-checking-to-creat.patch
new file mode 100644
index 000000000..c7ed55d04
--- /dev/null
+++ b/main/uwsgi/0003-core-socket-move-listen-queue-size-checking-to-creat.patch
@@ -0,0 +1,65 @@
+From 51a8f31f17440702b308b15e0c9dd73255cbb572 Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Wed, 1 Jan 2014 23:55:57 +0200
+Subject: [PATCH 3/5] core/socket: move listen queue size checking to
+ create_server_socket
+
+---
+ core/socket.c | 27 +++++++++------------------
+ 1 file changed, 9 insertions(+), 18 deletions(-)
+
+diff --git a/core/socket.c b/core/socket.c
+index ee63b98..3eed477 100644
+--- a/core/socket.c
++++ b/core/socket.c
+@@ -102,6 +102,15 @@ static int create_server_socket(int domain, int type) {
+ return -1;
+ }
+ }
++
++#ifdef __linux__
++ long somaxconn = uwsgi_num_from_file("/proc/sys/net/core/somaxconn", 1);
++ if (somaxconn > 0 && uwsgi.listen_queue > somaxconn) {
++ uwsgi_log("Listen queue size is greater than the system max net.core.somaxconn (%li).\n", somaxconn);
++ uwsgi_nuclear_blast();
++ return -1;
++ }
++#endif
+ }
+
+ return serverfd;
+@@ -208,15 +217,6 @@ int bind_to_unix(char *socket_name, int listen_queue, int chmod_socket, int abst
+ return -1;
+ }
+
+-#ifdef __linux__
+- long somaxconn = uwsgi_num_from_file("/proc/sys/net/core/somaxconn", 1);
+- if (somaxconn > 0 && uwsgi.listen_queue > somaxconn) {
+- uwsgi_log("Listen queue size is greater than the system max net.core.somaxconn (%li).\n", somaxconn);
+- uwsgi_nuclear_blast();
+- return -1;
+- }
+-#endif
+-
+ if (listen(serverfd, listen_queue) != 0) {
+ uwsgi_error("listen()");
+ uwsgi_nuclear_blast();
+@@ -761,15 +761,6 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) {
+ return -1;
+ }
+
+-#ifdef __linux__
+- long somaxconn = uwsgi_num_from_file("/proc/sys/net/core/somaxconn", 1);
+- if (somaxconn > 0 && uwsgi.listen_queue > somaxconn) {
+- uwsgi_log("Listen queue size is greater than the system max net.core.somaxconn (%li).\n", somaxconn);
+- uwsgi_nuclear_blast();
+- return -1;
+- }
+-#endif
+-
+ if (listen(serverfd, listen_queue) != 0) {
+ uwsgi_error("listen()");
+ uwsgi_nuclear_blast();
+--
+1.8.4.2
+