mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
fix: changes to opening new stream, setting quic connection parameters
1. Do not dial to open a new stream, use existing swarm connection in quic transport to open new stream 2. Derive values from quic config for quic stream configuration 3. Set quic-v1 config only if enabled
This commit is contained in:
@ -245,6 +245,13 @@ class Swarm(Service, INetworkService):
|
||||
"""
|
||||
logger.debug("attempting to open a stream to peer %s", peer_id)
|
||||
|
||||
if (
|
||||
isinstance(self.transport, QUICTransport)
|
||||
and self.connections[peer_id] is not None
|
||||
):
|
||||
conn = cast(SwarmConn, self.connections[peer_id])
|
||||
return await conn.new_stream()
|
||||
|
||||
swarm_conn = await self.dial_peer(peer_id)
|
||||
net_stream = await swarm_conn.new_stream()
|
||||
logger.debug("successfully opened a stream to peer %s", peer_id)
|
||||
@ -286,7 +293,7 @@ class Swarm(Service, INetworkService):
|
||||
await self.add_conn(quic_conn)
|
||||
peer_id = quic_conn.peer_id
|
||||
logger.debug(
|
||||
f"successfully opened connection to peer {peer_id}"
|
||||
f"successfully opened quic connection to peer {peer_id}"
|
||||
)
|
||||
# NOTE: This is a intentional barrier to prevent from the
|
||||
# handler exiting and closing the connection.
|
||||
|
||||
Reference in New Issue
Block a user