diff --git a/core/socket.c b/core/socket.c index 33e14008..33c2caa6 100644 --- a/core/socket.c +++ b/core/socket.c @@ -1714,6 +1714,10 @@ void uwsgi_bind_sockets() { while (uwsgi_sock) { if (!uwsgi_sock->bound && !uwsgi_socket_is_already_bound(uwsgi_sock->name)) { char *tcp_port = strrchr(uwsgi_sock->name, ':'); + int current_defer_accept = uwsgi.no_defer_accept; + if (uwsgi_sock->no_defer) { + uwsgi.no_defer_accept = 1; + } if (tcp_port == NULL) { uwsgi_sock->fd = bind_to_unix(uwsgi_sock->name, uwsgi.listen_queue, uwsgi.chmod_socket, uwsgi.abstract_socket); uwsgi_sock->family = AF_UNIX; @@ -1747,6 +1751,7 @@ void uwsgi_bind_sockets() { uwsgi_log("unable to create server socket on: %s\n", uwsgi_sock->name); exit(1); } + uwsgi.no_defer_accept = current_defer_accept; } uwsgi_sock->bound = 1; uwsgi_sock = uwsgi_sock->next; diff --git a/core/uwsgi.c b/core/uwsgi.c index 2cac0d82..176cb274 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -53,7 +53,7 @@ static struct uwsgi_option uwsgi_base_options[] = { {"scgi-modifier1", required_argument, 0, "force the specified modifier1 when using SCGI protocol", uwsgi_opt_set_64bit, &uwsgi.scgi_modifier1, 0}, {"scgi-modifier2", required_argument, 0, "force the specified modifier2 when using SCGI protocol", uwsgi_opt_set_64bit, &uwsgi.scgi_modifier2, 0}, - {"raw-socket", required_argument, 0, "bind to the specified UNIX/TCP socket using RAW protocol", uwsgi_opt_add_socket, "raw", 0}, + {"raw-socket", required_argument, 0, "bind to the specified UNIX/TCP socket using RAW protocol", uwsgi_opt_add_socket_no_defer, "raw", 0}, {"raw-modifier1", required_argument, 0, "force the specified modifier1 when using RAW protocol", uwsgi_opt_set_64bit, &uwsgi.raw_modifier1, 0}, {"raw-modifier2", required_argument, 0, "force the specified modifier2 when using RAW protocol", uwsgi_opt_set_64bit, &uwsgi.raw_modifier2, 0}, @@ -3932,6 +3932,13 @@ void uwsgi_opt_add_socket(char *opt, char *value, void *protocol) { uwsgi_sock->proto_name = protocol; } +void uwsgi_opt_add_socket_no_defer(char *opt, char *value, void *protocol) { + struct uwsgi_socket *uwsgi_sock = uwsgi_new_socket(generate_socket_name(value)); + uwsgi_sock->name_len = strlen(uwsgi_sock->name); + uwsgi_sock->proto_name = protocol; + uwsgi_sock->no_defer = 1; +} + void uwsgi_opt_add_lazy_socket(char *opt, char *value, void *protocol) { struct uwsgi_socket *uwsgi_sock = uwsgi_new_socket(generate_socket_name(value)); uwsgi_sock->proto_name = protocol; diff --git a/uwsgi.h b/uwsgi.h index 694318df..3a5c251b 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -3496,6 +3496,7 @@ void uwsgi_opt_dyn_false(char *, char *, void *); void uwsgi_opt_set_placeholder(char *, char *, void *); void uwsgi_opt_add_shared_socket(char *, char *, void *); void uwsgi_opt_add_socket(char *, char *, void *); +void uwsgi_opt_add_socket_no_defer(char *, char *, void *); void uwsgi_opt_add_lazy_socket(char *, char *, void *); void uwsgi_opt_add_cron(char *, char *, void *); void uwsgi_opt_add_cron2(char *, char *, void *);