Merge pull request #616 from r0fls/610

use socket.set_inheritable instead of os version
This commit is contained in:
Eli Uriegas 2017-04-04 15:17:31 -05:00 committed by GitHub
commit e9eca25792

View File

@ -5,13 +5,16 @@ import warnings
from functools import partial from functools import partial
from inspect import isawaitable from inspect import isawaitable
from multiprocessing import Process from multiprocessing import Process
from os import set_inheritable
from signal import ( from signal import (
SIGTERM, SIGINT, SIGTERM, SIGINT,
signal as signal_func, signal as signal_func,
Signals Signals
) )
from socket import socket, SOL_SOCKET, SO_REUSEADDR from socket import (
socket,
SOL_SOCKET,
SO_REUSEADDR,
)
from time import time from time import time
from httptools import HttpRequestParser from httptools import HttpRequestParser
@ -446,7 +449,7 @@ def serve_multiple(server_settings, workers):
sock = socket() sock = socket()
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
sock.bind((server_settings['host'], server_settings['port'])) sock.bind((server_settings['host'], server_settings['port']))
set_inheritable(sock.fileno(), True) sock.set_inheritable(True)
server_settings['sock'] = sock server_settings['sock'] = sock
server_settings['host'] = None server_settings['host'] = None
server_settings['port'] = None server_settings['port'] = None