Skip to content

Commit 429ea8a

Browse files
committed
bugfix: fix transport exception when multi client connect to same server.
1 parent dbb99ee commit 429ea8a

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/dubbo/protocol/triple/protocol.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def export(self, url: URL):
7777
# Create a stream handler
7878
stream_multiplexer = StreamServerMultiplexHandler(listener_factory)
7979
# set stream handler and protocol
80+
url.attributes[aio_constants.LISTENER_FACTORY_KEY] = listener_factory
8081
url.attributes[aio_constants.STREAM_HANDLER_KEY] = stream_multiplexer
8182
url.attributes[common_constants.PROTOCOL_KEY] = Http2ServerProtocol
8283

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, StreamClientMultiplexHandler
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()

0 commit comments

Comments
 (0)