Add ability to use string path for sock instead of forcing user to manually create socket.

This commit is contained in:
David Tan 2017-11-18 02:21:34 -05:00
parent 18b7f24a8f
commit 2782e426e7

View File

@ -568,19 +568,22 @@ def serve(host, port, request_handler, error_handler, before_start=None,
) )
if isinstance(sock, str): if isinstance(sock, str):
_create_server = loop.create_unix_server server_coroutine = loop.create_unix_server(
server,
path=sock,
ssl=ssl,
backlog=backlog
)
else: else:
_create_server = loop.create_server server_coroutine = loop.create_server(
server,
server_coroutine = _create_server( host,
server, port,
host, ssl=ssl,
port, reuse_port=reuse_port,
ssl=ssl, sock=sock,
reuse_port=reuse_port, backlog=backlog
sock=sock, )
backlog=backlog
)
# Instead of pulling time at the end of every request, # Instead of pulling time at the end of every request,
# pull it once per minute # pull it once per minute