Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/dubbo/protocol/triple/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
from dubbo.remoting.aio import constants as aio_constants
from dubbo.remoting.aio.http2.protocol import Http2ClientProtocol, Http2ServerProtocol
from dubbo.remoting.aio.http2.stream_handler import (
StreamClientMultiplexHandler,
StreamServerMultiplexHandler,
StreamClientMultiplexHandler
)
from dubbo.url import URL

Expand Down Expand Up @@ -74,10 +73,8 @@ def export(self, url: URL):

listener_factory = functools.partial(ServerTransportListener, self._path_resolver, method_executor)

# Create a stream handler
stream_multiplexer = StreamServerMultiplexHandler(listener_factory)
# set stream handler and protocol
url.attributes[aio_constants.STREAM_HANDLER_KEY] = stream_multiplexer
url.attributes[aio_constants.LISTENER_FACTORY_KEY] = listener_factory
url.attributes[common_constants.PROTOCOL_KEY] = Http2ServerProtocol

# Create a server
Expand Down
2 changes: 2 additions & 0 deletions src/dubbo/remoting/aio/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

STREAM_HANDLER_KEY = "stream-handler"

LISTENER_FACTORY_KEY = "listener-factory"

CLOSE_FUTURE_KEY = "close-future"

HEARTBEAT_KEY = "heartbeat"
Expand Down
8 changes: 7 additions & 1 deletion src/dubbo/remoting/aio/http2/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
from h2.config import H2Configuration
from h2.connection import H2Connection

from dubbo.constants import common_constants
from dubbo.loggers import loggerFactory
from dubbo.remoting.aio import ConnectionStateListener, EmptyConnectionStateListener, constants as h2_constants
from dubbo.remoting.aio.exceptions import ProtocolError
from dubbo.remoting.aio.http2.stream_handler import StreamServerMultiplexHandler
from dubbo.remoting.aio.http2.controllers import RemoteFlowController
from dubbo.remoting.aio.http2.frames import (
DataFrame,
Expand Down Expand Up @@ -76,7 +78,11 @@ def __init__(self, url: URL, h2_config: H2Configuration):

self._flow_controller: Optional[RemoteFlowController] = None

self._stream_handler = self._url.attributes[h2_constants.STREAM_HANDLER_KEY]
if self._url.attributes[common_constants.PROTOCOL_KEY] == Http2ServerProtocol:
listener_factory = self._url.attributes[h2_constants.LISTENER_FACTORY_KEY]
self._stream_handler = StreamServerMultiplexHandler(listener_factory)
else:
self._stream_handler = self._url.attributes[h2_constants.STREAM_HANDLER_KEY]

# last time of receiving data
self._last_read = time.time()
Expand Down