aboutsummaryrefslogtreecommitdiffstats
path: root/main/uwsgi
diff options
context:
space:
mode:
Diffstat (limited to 'main/uwsgi')
-rw-r--r--main/uwsgi/0001-core-socket-common-socket-creation-function-for-bind.patch91
-rw-r--r--main/uwsgi/0002-core-socket-move-socket-buffer-size-setting-to-creat.patch97
-rw-r--r--main/uwsgi/0003-core-socket-move-listen-queue-size-checking-to-creat.patch65
-rw-r--r--main/uwsgi/0004-core-socket-move-SO_REUSEADDR-setting-to-create_serv.patch73
-rw-r--r--main/uwsgi/0005-option-for-closing-server-sockets-when-spawning.patch70
5 files changed, 0 insertions, 396 deletions
diff --git a/main/uwsgi/0001-core-socket-common-socket-creation-function-for-bind.patch b/main/uwsgi/0001-core-socket-common-socket-creation-function-for-bind.patch
deleted file mode 100644
index 45b861f500..0000000000
--- a/main/uwsgi/0001-core-socket-common-socket-creation-function-for-bind.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 4d43a66581168674a9db52ac9bf690fa4f106dca Mon Sep 17 00:00:00 2001
-From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
-Date: Wed, 1 Jan 2014 23:36:26 +0200
-Subject: [PATCH 1/5] core/socket: common socket creation function for
- bind_to_*
-
----
- core/socket.c | 40 +++++++++++++++++-----------------------
- 1 file changed, 17 insertions(+), 23 deletions(-)
-
-diff --git a/core/socket.c b/core/socket.c
-index 0696eff..7e47dc0 100644
---- a/core/socket.c
-+++ b/core/socket.c
-@@ -76,18 +76,23 @@ char *uwsgi_getsockname(int fd) {
- return NULL;
- }
-
-+static int create_server_socket(int domain, int type) {
-+ int serverfd = socket(domain, type, 0);
-+ if (serverfd < 0) {
-+ uwsgi_error("socket()");
-+ uwsgi_nuclear_blast();
-+ }
-+ return serverfd;
-+}
-+
- int bind_to_unix_dgram(char *socket_name) {
-
- int serverfd;
- struct sockaddr_un *uws_addr;
- socklen_t len;
-
-- serverfd = socket(AF_UNIX, SOCK_DGRAM, 0);
-- if (serverfd < 0) {
-- uwsgi_error("socket()");
-- uwsgi_nuclear_blast();
-- return -1;
-- }
-+ serverfd = create_server_socket(AF_UNIX, SOCK_DGRAM);
-+ if (serverfd < 0) return -1;
-
- if (unlink(socket_name) != 0 && errno != ENOENT) {
- uwsgi_error("error removing unix socket, unlink()");
-@@ -140,12 +145,8 @@ int bind_to_unix(char *socket_name, int listen_queue, int chmod_socket, int abst
- }
-
- memset(uws_addr, 0, sizeof(struct sockaddr_un));
-- serverfd = socket(AF_UNIX, SOCK_STREAM, 0);
-- if (serverfd < 0) {
-- uwsgi_error("socket()");
-- uwsgi_nuclear_blast();
-- return -1;
-- }
-+ serverfd = create_server_socket(AF_UNIX, SOCK_STREAM);
-+ if (serverfd < 0) return -1;
- if (abstract_socket == 0) {
- if (unlink(socket_name) != 0 && errno != ENOENT) {
- uwsgi_error("unlink()");
-@@ -288,11 +289,8 @@ int bind_to_udp(char *socket_name, int multicast, int broadcast) {
- }
-
-
-- serverfd = socket(AF_INET, SOCK_DGRAM, 0);
-- if (serverfd < 0) {
-- uwsgi_error("socket()");
-- return -1;
-- }
-+ serverfd = create_server_socket(AF_INET, SOCK_DGRAM);
-+ if (serverfd < 0) return -1;
-
- if (setsockopt(serverfd, SOL_SOCKET, SO_REUSEADDR, (const void *) &reuse, sizeof(int)) < 0) {
- uwsgi_error("setsockopt()");
-@@ -667,12 +665,8 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) {
- #endif
-
-
-- serverfd = socket(family, SOCK_STREAM, 0);
-- if (serverfd < 0) {
-- uwsgi_error("socket()");
-- uwsgi_nuclear_blast();
-- return -1;
-- }
-+ serverfd = create_server_socket(family, SOCK_STREAM);
-+ if (serverfd < 0) return -1;
-
- if (uwsgi.so_sndbuf) {
- socklen_t sndbuf = (socklen_t) uwsgi.so_sndbuf;
---
-1.8.4.2
-
diff --git a/main/uwsgi/0002-core-socket-move-socket-buffer-size-setting-to-creat.patch b/main/uwsgi/0002-core-socket-move-socket-buffer-size-setting-to-creat.patch
deleted file mode 100644
index 88cb2b73a4..0000000000
--- a/main/uwsgi/0002-core-socket-move-socket-buffer-size-setting-to-creat.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From 32b71268365456f246d20212e0acf63bfdf9ffe6 Mon Sep 17 00:00:00 2001
-From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
-Date: Wed, 1 Jan 2014 23:46:02 +0200
-Subject: [PATCH 2/5] core/socket: move socket buffer size setting to
- create_server_socket
-
----
- core/socket.c | 58 ++++++++++++++++++++++------------------------------------
- 1 file changed, 22 insertions(+), 36 deletions(-)
-
-diff --git a/core/socket.c b/core/socket.c
-index 7e47dc0..ee63b98 100644
---- a/core/socket.c
-+++ b/core/socket.c
-@@ -81,7 +81,29 @@ static int create_server_socket(int domain, int type) {
- if (serverfd < 0) {
- uwsgi_error("socket()");
- uwsgi_nuclear_blast();
-+ return -1;
-+ }
-+
-+ if (type == SOCK_STREAM) {
-+ if (uwsgi.so_sndbuf) {
-+ socklen_t sndbuf = (socklen_t) uwsgi.so_sndbuf;
-+ if (setsockopt(serverfd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(socklen_t)) < 0) {
-+ uwsgi_error("SO_SNDBUF setsockopt()");
-+ uwsgi_nuclear_blast();
-+ return -1;
-+ }
-+ }
-+
-+ if (uwsgi.so_rcvbuf) {
-+ socklen_t rcvbuf = (socklen_t) uwsgi.so_rcvbuf;
-+ if (setsockopt(serverfd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(socklen_t)) < 0) {
-+ uwsgi_error("SO_RCVBUF setsockopt()");
-+ uwsgi_nuclear_blast();
-+ return -1;
-+ }
-+ }
- }
-+
- return serverfd;
- }
-
-@@ -157,24 +179,6 @@ int bind_to_unix(char *socket_name, int listen_queue, int chmod_socket, int abst
- uwsgi_log("setting abstract socket mode (warning: only Linux supports this)\n");
- }
-
-- if (uwsgi.so_sndbuf) {
-- socklen_t sndbuf = (socklen_t) uwsgi.so_sndbuf;
-- if (setsockopt(serverfd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(socklen_t)) < 0) {
-- uwsgi_error("SO_SNDBUF setsockopt()");
-- uwsgi_nuclear_blast();
-- return -1;
-- }
-- }
--
-- if (uwsgi.so_rcvbuf) {
-- socklen_t rcvbuf = (socklen_t) uwsgi.so_rcvbuf;
-- if (setsockopt(serverfd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(socklen_t)) < 0) {
-- uwsgi_error("SO_RCVBUF setsockopt()");
-- uwsgi_nuclear_blast();
-- return -1;
-- }
-- }
--
- uws_addr->sun_family = AF_UNIX;
- if (socket_name[0] == '@') {
- memcpy(uws_addr->sun_path + abstract_socket, socket_name + 1, UMIN(strlen(socket_name + 1), 101));
-@@ -668,24 +672,6 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) {
- serverfd = create_server_socket(family, SOCK_STREAM);
- if (serverfd < 0) return -1;
-
-- if (uwsgi.so_sndbuf) {
-- socklen_t sndbuf = (socklen_t) uwsgi.so_sndbuf;
-- if (setsockopt(serverfd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(socklen_t)) < 0) {
-- uwsgi_error("SO_SNDBUF setsockopt()");
-- uwsgi_nuclear_blast();
-- return -1;
-- }
-- }
--
-- if (uwsgi.so_rcvbuf) {
-- socklen_t rcvbuf = (socklen_t) uwsgi.so_rcvbuf;
-- if (setsockopt(serverfd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(socklen_t)) < 0) {
-- uwsgi_error("SO_RCVBUF setsockopt()");
-- uwsgi_nuclear_blast();
-- return -1;
-- }
-- }
--
- if (setsockopt(serverfd, SOL_SOCKET, SO_REUSEADDR, (const void *) &reuse, sizeof(int)) < 0) {
- uwsgi_error("SO_REUSEADDR setsockopt()");
- uwsgi_nuclear_blast();
---
-1.8.4.2
-
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
deleted file mode 100644
index c7ed55d04c..0000000000
--- a/main/uwsgi/0003-core-socket-move-listen-queue-size-checking-to-creat.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-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
-
diff --git a/main/uwsgi/0004-core-socket-move-SO_REUSEADDR-setting-to-create_serv.patch b/main/uwsgi/0004-core-socket-move-SO_REUSEADDR-setting-to-create_serv.patch
deleted file mode 100644
index 904828b43f..0000000000
--- a/main/uwsgi/0004-core-socket-move-SO_REUSEADDR-setting-to-create_serv.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 4f4f9b93aae55e40dc7f92e19a7e5080a06ce798 Mon Sep 17 00:00:00 2001
-From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
-Date: Thu, 2 Jan 2014 00:05:01 +0200
-Subject: [PATCH 4/5] core/socket: move SO_REUSEADDR setting to
- create_server_socket
-
----
- core/socket.c | 21 +++++++++------------
- 1 file changed, 9 insertions(+), 12 deletions(-)
-
-diff --git a/core/socket.c b/core/socket.c
-index 3eed477..6d5d7d7 100644
---- a/core/socket.c
-+++ b/core/socket.c
-@@ -84,6 +84,15 @@ static int create_server_socket(int domain, int type) {
- return -1;
- }
-
-+ if (domain != AF_UNIX) {
-+ int reuse = 1;
-+ if (setsockopt(serverfd, SOL_SOCKET, SO_REUSEADDR, (const void *) &reuse, sizeof(int)) < 0) {
-+ uwsgi_error("SO_REUSEADDR setsockopt()");
-+ uwsgi_nuclear_blast();
-+ return -1;
-+ }
-+ }
-+
- if (type == SOCK_STREAM) {
- if (uwsgi.so_sndbuf) {
- socklen_t sndbuf = (socklen_t) uwsgi.so_sndbuf;
-@@ -248,7 +257,6 @@ int bind_to_udp(char *socket_name, int multicast, int broadcast) {
- struct sockaddr_in uws_addr;
- char *udp_port;
- int bcast = 1;
-- int reuse = 1;
-
- struct ip_mreq mc;
-
-@@ -296,10 +304,6 @@ int bind_to_udp(char *socket_name, int multicast, int broadcast) {
- serverfd = create_server_socket(AF_INET, SOCK_DGRAM);
- if (serverfd < 0) return -1;
-
-- if (setsockopt(serverfd, SOL_SOCKET, SO_REUSEADDR, (const void *) &reuse, sizeof(int)) < 0) {
-- uwsgi_error("setsockopt()");
-- }
--
- if (multicast) {
- // if multicast is enabled remember to bind to INADDR_ANY
- uws_addr.sin_addr.s_addr = INADDR_ANY;
-@@ -651,7 +655,6 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) {
- #else
- struct sockaddr_in uws_addr;
- #endif
-- int reuse = 1;
- int family = AF_INET;
- socklen_t addr_len = sizeof(struct sockaddr_in);
-
-@@ -672,12 +675,6 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) {
- serverfd = create_server_socket(family, SOCK_STREAM);
- if (serverfd < 0) return -1;
-
-- if (setsockopt(serverfd, SOL_SOCKET, SO_REUSEADDR, (const void *) &reuse, sizeof(int)) < 0) {
-- uwsgi_error("SO_REUSEADDR setsockopt()");
-- uwsgi_nuclear_blast();
-- return -1;
-- }
--
- #ifdef __linux__
- #ifndef IP_FREEBIND
- #define IP_FREEBIND 15
---
-1.8.4.2
-
diff --git a/main/uwsgi/0005-option-for-closing-server-sockets-when-spawning.patch b/main/uwsgi/0005-option-for-closing-server-sockets-when-spawning.patch
deleted file mode 100644
index b91f1d62ed..0000000000
--- a/main/uwsgi/0005-option-for-closing-server-sockets-when-spawning.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From de160406dbe358fb599eb8343e82f18252247a19 Mon Sep 17 00:00:00 2001
-From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
-Date: Wed, 1 Jan 2014 03:51:56 +0200
-Subject: [PATCH 5/5] option for closing server sockets when spawning
-
-If server fd is not closed, it is not possible to restart uwsgi if the
-spawned process is still running as it keeps the address/port bound.
----
- core/master_utils.c | 1 +
- core/socket.c | 3 +++
- core/uwsgi.c | 3 ++-
- uwsgi.h | 2 ++
- 4 files changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/core/master_utils.c b/core/master_utils.c
-index 89151a0..6316209 100644
---- a/core/master_utils.c
-+++ b/core/master_utils.c
-@@ -407,6 +407,7 @@ void uwsgi_reload(char **argv) {
- /* check fd table (a module can obviosly open some fd on initialization...) */
- uwsgi_log("closing all non-uwsgi socket fds > 2 (max_fd = %d)...\n", (int) uwsgi.max_fd);
- for (i = 3; i < (int) uwsgi.max_fd; i++) {
-+ fcntl(i, F_SETFD, 0);
-
- if (uwsgi_fd_is_safe(i)) continue;
-
-diff --git a/core/socket.c b/core/socket.c
-index 6d5d7d7..8b66a47 100644
---- a/core/socket.c
-+++ b/core/socket.c
-@@ -84,6 +84,9 @@ static int create_server_socket(int domain, int type) {
- return -1;
- }
-
-+ if (uwsgi.close_on_exec2 && fcntl(serverfd, F_SETFD, FD_CLOEXEC) < 0)
-+ uwsgi_error("fcntl()");
-+
- if (domain != AF_UNIX) {
- int reuse = 1;
- if (setsockopt(serverfd, SOL_SOCKET, SO_REUSEADDR, (const void *) &reuse, sizeof(int)) < 0) {
-diff --git a/core/uwsgi.c b/core/uwsgi.c
-index 51821bc..d3d6538 100644
---- a/core/uwsgi.c
-+++ b/core/uwsgi.c
-@@ -871,7 +871,8 @@ static struct uwsgi_option uwsgi_base_options[] = {
- {"disable-sendfile", no_argument, 0, "disable sendfile() and rely on boring read()/write()", uwsgi_opt_true, &uwsgi.disable_sendfile, 0},
-
- {"check-cache", optional_argument, 0, "check for response data in the specified cache (empty for default cache)", uwsgi_opt_set_str, &uwsgi.use_check_cache, 0},
-- {"close-on-exec", no_argument, 0, "set close-on-exec on sockets (could be required for spawning processes in requests)", uwsgi_opt_true, &uwsgi.close_on_exec, 0},
-+ {"close-on-exec", no_argument, 0, "set close-on-exec on connection sockets (could be required for spawning processes in requests)", uwsgi_opt_true, &uwsgi.close_on_exec, 0},
-+ {"close-on-exec2", no_argument, 0, "set close-on-exec on server sockets (could be required for spawning processes in requests)", uwsgi_opt_true, &uwsgi.close_on_exec2, 0},
- {"mode", required_argument, 0, "set uWSGI custom mode", uwsgi_opt_set_str, &uwsgi.mode, 0},
- {"env", required_argument, 0, "set environment variable", uwsgi_opt_set_env, NULL, 0},
- {"envdir", required_argument, 0, "load a daemontools compatible envdir", uwsgi_opt_add_string_list, &uwsgi.envdirs, 0},
-diff --git a/uwsgi.h b/uwsgi.h
-index 29dfc2d..ccb41d4 100644
---- a/uwsgi.h
-+++ b/uwsgi.h
-@@ -2516,6 +2516,8 @@ struct uwsgi_server {
- void (*gbcw_hook) (void);
-
- int close_on_exec;
-+ int close_on_exec2;
-+
- int tcp_nodelay;
-
- char *loop;
---
-1.8.4.2
-