Skip to content

Commit 755fc8d

Browse files
authored
Merge branch 'apache:main' into main
2 parents 84717dd + 462a3f7 commit 755fc8d

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/dubbo/protocol/triple/protocol.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
from dubbo.remoting.aio import constants as aio_constants
3232
from dubbo.remoting.aio.http2.protocol import Http2ClientProtocol, Http2ServerProtocol
3333
from dubbo.remoting.aio.http2.stream_handler import (
34-
StreamClientMultiplexHandler,
35-
StreamServerMultiplexHandler,
34+
StreamClientMultiplexHandler
3635
)
3736
from dubbo.url import URL
3837

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

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

77-
# Create a stream handler
78-
stream_multiplexer = StreamServerMultiplexHandler(listener_factory)
7976
# set stream handler and protocol
80-
url.attributes[aio_constants.STREAM_HANDLER_KEY] = stream_multiplexer
77+
url.attributes[aio_constants.LISTENER_FACTORY_KEY] = listener_factory
8178
url.attributes[common_constants.PROTOCOL_KEY] = Http2ServerProtocol
8279

8380
# Create a server

src/dubbo/remoting/aio/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
STREAM_HANDLER_KEY = "stream-handler"
2020

21+
LISTENER_FACTORY_KEY = "listener-factory"
22+
2123
CLOSE_FUTURE_KEY = "close-future"
2224

2325
HEARTBEAT_KEY = "heartbeat"

src/dubbo/remoting/aio/http2/protocol.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
from h2.config import H2Configuration
2323
from h2.connection import H2Connection
2424

25+
from dubbo.constants import common_constants
2526
from dubbo.loggers import loggerFactory
2627
from dubbo.remoting.aio import ConnectionStateListener, EmptyConnectionStateListener, constants as h2_constants
2728
from dubbo.remoting.aio.exceptions import ProtocolError
29+
from dubbo.remoting.aio.http2.stream_handler import StreamServerMultiplexHandler
2830
from dubbo.remoting.aio.http2.controllers import RemoteFlowController
2931
from dubbo.remoting.aio.http2.frames import (
3032
DataFrame,
@@ -76,7 +78,11 @@ def __init__(self, url: URL, h2_config: H2Configuration):
7678

7779
self._flow_controller: Optional[RemoteFlowController] = None
7880

79-
self._stream_handler = self._url.attributes[h2_constants.STREAM_HANDLER_KEY]
81+
if self._url.attributes[common_constants.PROTOCOL_KEY] == Http2ServerProtocol:
82+
listener_factory = self._url.attributes[h2_constants.LISTENER_FACTORY_KEY]
83+
self._stream_handler = StreamServerMultiplexHandler(listener_factory)
84+
else:
85+
self._stream_handler = self._url.attributes[h2_constants.STREAM_HANDLER_KEY]
8086

8187
# last time of receiving data
8288
self._last_read = time.time()

src/dubbo/types.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,4 @@ def from_name(cls, name: str) -> RpcType:
5757
# ignore case
5858
if item.value.name.lower() == name.lower():
5959
return item.value
60-
if item.value.name == name:
61-
return item.value
6260
raise ValueError(f"Unknown RpcType name: {name}")

0 commit comments

Comments
 (0)