added --undeferred-shared-socket

This commit is contained in:
Roberto De Ioris
2012-11-11 19:41:00 +01:00
parent a48af2e226
commit b2a1237781
3 changed files with 15 additions and 1 deletions
+9
View File
@@ -1484,6 +1484,10 @@ void uwsgi_setup_shared_sockets() {
while (shared_sock) {
if (!uwsgi.is_a_reload) {
char *tcp_port = strrchr(shared_sock->name, ':');
int current_defer_accept = uwsgi.no_defer_accept;
if (shared_sock->no_defer) {
uwsgi.no_defer_accept = 1;
}
if (tcp_port == NULL) {
shared_sock->fd = bind_to_unix(shared_sock->name, uwsgi.listen_queue, uwsgi.chmod_socket, uwsgi.abstract_socket);
shared_sock->family = AF_UNIX;
@@ -1514,6 +1518,11 @@ void uwsgi_setup_shared_sockets() {
uwsgi_log("unable to create shared socket on: %s\n", shared_sock->name);
exit(1);
}
if (shared_sock->no_defer) {
uwsgi.no_defer_accept = current_defer_accept;
}
}
else {
for (i = 3; i < (int) uwsgi.max_fd; i++) {
+5 -1
View File
@@ -42,6 +42,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"protocol", required_argument, 0, "force the specified protocol for default sockets", uwsgi_opt_set_str, &uwsgi.protocol, 0},
{"socket-protocol", required_argument, 0, "force the specified protocol for default sockets", uwsgi_opt_set_str, &uwsgi.protocol, 0},
{"shared-socket", required_argument, 0, "create a shared sacket for advanced jailing or ipc", uwsgi_opt_add_shared_socket, NULL, 0},
{"undeferred-shared-socket", required_argument, 0, "create a shared sacket for advanced jailing or ipc (undeferred mode)", uwsgi_opt_add_shared_socket, NULL, 0},
{"processes", required_argument, 'p', "spawn the specified number of workers/processes", uwsgi_opt_set_int, &uwsgi.numproc, 0},
{"workers", required_argument, 'p', "spawn the specified number of workers/processes", uwsgi_opt_set_int, &uwsgi.numproc, 0},
{"harakiri", required_argument, 't', "set harakiri timeout", uwsgi_opt_set_dyn, (void *) UWSGI_OPTION_HARAKIRI, 0},
@@ -3294,7 +3295,10 @@ void uwsgi_opt_add_regexp_custom_list(char *opt, char *value, void *list) {
#endif
void uwsgi_opt_add_shared_socket(char *opt, char *value, void *protocol) {
uwsgi_new_shared_socket(generate_socket_name(value));
struct uwsgi_socket *us = uwsgi_new_shared_socket(generate_socket_name(value));
if (!strcmp(opt, "undeferred-shared-socket")) {
us->no_defer = 1;
}
}
void uwsgi_opt_add_socket(char *opt, char *value, void *protocol) {
+1
View File
@@ -641,6 +641,7 @@ struct uwsgi_socket {
void *ctx;
int queue;
int no_defer;
int auto_port;
// true if connection must be initialized for each core