diff --git a/sanic/mixins/runner.py b/sanic/mixins/runner.py index 1a8cfbbd..6f288ff1 100644 --- a/sanic/mixins/runner.py +++ b/sanic/mixins/runner.py @@ -185,7 +185,9 @@ class RunnerMixin(metaclass=SanicMeta): ) -> None: if version == 3 and self.state.server_info: 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: diff --git a/sanic/server/runners.py b/sanic/server/runners.py index 980f8348..86779472 100644 --- a/sanic/server/runners.py +++ b/sanic/server/runners.py @@ -95,8 +95,47 @@ def serve( app.asgi = False 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() protocol_kwargs = _build_protocol_kwargs(protocol, app.config) server = partial( @@ -201,7 +240,7 @@ def serve( remove_unix_socket(unix) -def serve_http_3( +def _serve_http_3( host, port, app,