Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions src/dubbo/protocol/triple/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def export(self, url: URL):
# Create a stream handler
stream_multiplexer = StreamServerMultiplexHandler(listener_factory)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have already passed in the listener_factory, so there is no need to pass in the StreamServerMultiplexHandler, since it is created in Http2Protocol; it should be removed here.

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

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