Better exception
This commit is contained in:
parent
96a746e468
commit
6e3e5f1662
@ -185,7 +185,9 @@ class RunnerMixin(metaclass=SanicMeta):
|
|||||||
) -> None:
|
) -> None:
|
||||||
if version == 3 and self.state.server_info:
|
if version == 3 and self.state.server_info:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Serving multiple HTTP/3 instances is not supported."
|
"Serving HTTP/3 instances as a secondary server is "
|
||||||
|
"not supported. There can only be a single HTTP/3 worker "
|
||||||
|
"and it must be prepared first."
|
||||||
)
|
)
|
||||||
|
|
||||||
if dev:
|
if dev:
|
||||||
|
@ -95,8 +95,47 @@ def serve(
|
|||||||
app.asgi = False
|
app.asgi = False
|
||||||
|
|
||||||
if version is HTTP.VERSION_3:
|
if version is HTTP.VERSION_3:
|
||||||
return serve_http_3(host, port, app, loop, ssl)
|
return _serve_http_3(host, port, app, loop, ssl)
|
||||||
|
return _serve_http_1(
|
||||||
|
host,
|
||||||
|
port,
|
||||||
|
app,
|
||||||
|
ssl,
|
||||||
|
sock,
|
||||||
|
unix,
|
||||||
|
reuse_port,
|
||||||
|
loop,
|
||||||
|
protocol,
|
||||||
|
backlog,
|
||||||
|
register_sys_signals,
|
||||||
|
run_multiple,
|
||||||
|
run_async,
|
||||||
|
connections,
|
||||||
|
signal,
|
||||||
|
state,
|
||||||
|
asyncio_server_kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _serve_http_1(
|
||||||
|
host,
|
||||||
|
port,
|
||||||
|
app,
|
||||||
|
ssl,
|
||||||
|
sock,
|
||||||
|
unix,
|
||||||
|
reuse_port,
|
||||||
|
loop,
|
||||||
|
protocol,
|
||||||
|
backlog,
|
||||||
|
register_sys_signals,
|
||||||
|
run_multiple,
|
||||||
|
run_async,
|
||||||
|
connections,
|
||||||
|
signal,
|
||||||
|
state,
|
||||||
|
asyncio_server_kwargs,
|
||||||
|
):
|
||||||
connections = connections if connections is not None else set()
|
connections = connections if connections is not None else set()
|
||||||
protocol_kwargs = _build_protocol_kwargs(protocol, app.config)
|
protocol_kwargs = _build_protocol_kwargs(protocol, app.config)
|
||||||
server = partial(
|
server = partial(
|
||||||
@ -201,7 +240,7 @@ def serve(
|
|||||||
remove_unix_socket(unix)
|
remove_unix_socket(unix)
|
||||||
|
|
||||||
|
|
||||||
def serve_http_3(
|
def _serve_http_3(
|
||||||
host,
|
host,
|
||||||
port,
|
port,
|
||||||
app,
|
app,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user