special handling when sock is provided and number of workers > 1
This commit is contained in:
parent
b87dc37fbb
commit
e5c32e9b48
|
@ -396,6 +396,8 @@ def serve_multiple(server_settings, workers, stop_event=None):
|
|||
" has more information.", DeprecationWarning)
|
||||
server_settings['reuse_port'] = True
|
||||
|
||||
# Handling when custom socket is not provided.
|
||||
if server_settings.get('sock') == None:
|
||||
sock = socket()
|
||||
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
|
||||
sock.bind((server_settings['host'], server_settings['port']))
|
||||
|
@ -423,6 +425,6 @@ def serve_multiple(server_settings, workers, stop_event=None):
|
|||
# the above processes will block this until they're stopped
|
||||
for process in processes:
|
||||
process.terminate()
|
||||
sock.close()
|
||||
server_settings.get('sock').close()
|
||||
|
||||
asyncio.get_event_loop().stop()
|
||||
|
|
Loading…
Reference in New Issue
Block a user