File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1010import sys
1111import time
1212import traceback
13+ import socket
1314
1415from gunicorn .errors import HaltServer , AppImportError
1516from gunicorn .pidfile import Pidfile
@@ -152,7 +153,8 @@ def start(self):
152153 for fd in os .environ .pop ('GUNICORN_FD' ).split (',' ):
153154 fds .append (int (fd ))
154155
155- self .LISTENERS = sock .create_sockets (self .cfg , self .log , fds )
156+ if not (self .cfg .reuse_port and hasattr (socket , 'SO_REUSEPORT' )):
157+ self .LISTENERS = sock .create_sockets (self .cfg , self .log , fds )
156158
157159 listeners_str = "," .join ([str (lnr ) for lnr in self .LISTENERS ])
158160 self .log .debug ("Arbiter booted" )
@@ -579,6 +581,8 @@ def spawn_worker(self):
579581 try :
580582 util ._setproctitle ("worker [%s]" % self .proc_name )
581583 self .log .info ("Booting worker with pid: %s" , worker .pid )
584+ if self .cfg .reuse_port :
585+ worker .sockets = sock .create_sockets (self .cfg , self .log )
582586 self .cfg .post_fork (self , worker )
583587 worker .init_process ()
584588 sys .exit (0 )
You can’t perform that action at this time.
0 commit comments