mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 21:51:30 +00:00
fixed shared sockets
This commit is contained in:
@@ -107,6 +107,7 @@ struct uwsgi_gateway_socket *uwsgi_new_gateway_socket(char *name, char *owner) {
|
||||
|
||||
memset(uwsgi_sock, 0, sizeof(struct uwsgi_gateway_socket));
|
||||
uwsgi_sock->fd = -1;
|
||||
uwsgi_sock->shared = 0;
|
||||
uwsgi_sock->name = name;
|
||||
uwsgi_sock->owner = owner;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ static void uwsgi_corerouter_setup_sockets(char *gw_id) {
|
||||
int shared_socket = atoi(ugs->name+1);
|
||||
if (shared_socket >= 0) {
|
||||
ugs->fd = uwsgi_get_shared_socket_fd_by_num(shared_socket);
|
||||
ugs->shared = 1;
|
||||
if (ugs->fd == -1) {
|
||||
uwsgi_log("unable to use shared socket %d\n", shared_socket);
|
||||
exit(1);
|
||||
|
||||
+4
-1
@@ -371,7 +371,10 @@ void uwsgi_fixup_fds(int wid, int muleid, struct uwsgi_gateway *ug) {
|
||||
ugs = ugs->next;
|
||||
continue;
|
||||
}
|
||||
close(ugs->fd);
|
||||
// do not close shared sockets !!!
|
||||
if (!ugs->shared) {
|
||||
close(ugs->fd);
|
||||
}
|
||||
ugs = ugs->next;
|
||||
}
|
||||
// fix the communication pipe
|
||||
|
||||
@@ -1670,7 +1670,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
uwsgi_sock->fd = shared_sock->fd;
|
||||
uwsgi_sock->family = shared_sock->family;
|
||||
uwsgi_sock->name = shared_sock->name;
|
||||
uwsgi_log("uwsgi socket %d mapped to shared socket %d (%s)\n", uwsgi_get_socket_num(uwsgi_sock), uwsgi_get_shared_socket_num(shared_sock), shared_sock->name);
|
||||
uwsgi_log("uwsgi socket %d mapped to shared socket %d (%s) fd %d\n", uwsgi_get_socket_num(uwsgi_sock), uwsgi_get_shared_socket_num(shared_sock), shared_sock->name, uwsgi_sock->fd);
|
||||
}
|
||||
|
||||
uwsgi_sock = uwsgi_sock->next;
|
||||
|
||||
Reference in New Issue
Block a user