From 2782e426e73c197e3a836c226d41421244e7d211 Mon Sep 17 00:00:00 2001 From: David Tan Date: Sat, 18 Nov 2017 02:21:34 -0500 Subject: [PATCH] Add ability to use string path for `sock` instead of forcing user to manually create socket. --- sanic/server.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/sanic/server.py b/sanic/server.py index 24108811..d83042eb 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -568,19 +568,22 @@ def serve(host, port, request_handler, error_handler, before_start=None, ) if isinstance(sock, str): - _create_server = loop.create_unix_server + server_coroutine = loop.create_unix_server( + server, + path=sock, + ssl=ssl, + backlog=backlog + ) else: - _create_server = loop.create_server - - server_coroutine = _create_server( - server, - host, - port, - ssl=ssl, - reuse_port=reuse_port, - sock=sock, - backlog=backlog - ) + server_coroutine = loop.create_server( + server, + host, + port, + ssl=ssl, + reuse_port=reuse_port, + sock=sock, + backlog=backlog + ) # Instead of pulling time at the end of every request, # pull it once per minute