update libp2p & fixes

This commit is contained in:
SionoiS 2026-04-28 10:30:59 -04:00
parent e0d5c2e331
commit fdff21ce0f
No known key found for this signature in database
GPG Key ID: C9458A8CB1852951
5 changed files with 10 additions and 11 deletions

View File

@ -27,7 +27,7 @@ requires "nim >= 2.2.4",
"toml_serialization",
"faststreams",
# Networking & P2P
"https://github.com/vacp2p/nim-libp2p.git#ff8d51857b4b79a68468e7bcc27b2026cca02996",
"https://github.com/vacp2p/nim-libp2p.git#9b6fedca059f3c054582407be9268e2999c7d05d",
"eth",
"nat_traversal",
"dnsdisc",

View File

@ -14,6 +14,7 @@ import
../discovery/waku_discv5,
../waku_node,
../node/peer_manager,
../node/waku_switch,
../common/rate_limit/setting,
../common/utils/parse_size_units,
../common/broker/broker_context
@ -189,7 +190,7 @@ proc build*(builder: WakuNodeBuilder): Result[WakuNode, string] =
wsAddress = builder.netConfig.get().wsHostAddress,
transportFlags = {ServerFlags.ReuseAddr, ServerFlags.TcpNoDelay},
rng = rng,
maxConnections = builder.switchMaxConnections.get(builders.MaxConnections),
maxConnections = builder.switchMaxConnections.get(MaxConnections),
wssEnabled = builder.netConfig.get().wssEnabled,
secureKeyPath = builder.switchSslSecureKey.get(""),
secureCertPath = builder.switchSslSecureCert.get(""),
@ -209,7 +210,7 @@ proc build*(builder: WakuNodeBuilder): Result[WakuNode, string] =
maxServicePeers = some(builder.maxServicePeers),
colocationLimit = builder.colocationLimit,
shardedPeerManagement = builder.shardAware,
maxConnections = builder.switchMaxConnections.get(builders.MaxConnections),
maxConnections = builder.switchMaxConnections.get(MaxConnections),
)
var node: WakuNode

View File

@ -23,6 +23,7 @@ import
common/utils/parse_size_units,
common/broker/broker_context,
node/health_monitor/online_monitor,
node/waku_switch,
],
./peer_store/peer_storage,
./waku_peer_store

View File

@ -635,9 +635,6 @@ proc stop*(node: WakuNode) {.async.} =
not node.wakuPeerExchangeClient.pxLoopHandle.isNil():
await node.wakuPeerExchangeClient.pxLoopHandle.cancelAndWait()
if not node.wakuKademlia.isNil():
await node.wakuKademlia.stop()
if not node.wakuRendezvousClient.isNil():
await node.wakuRendezvousClient.stopWait()

View File

@ -19,7 +19,8 @@ import
libp2p/transports/[transport, tcptransport, wstransport],
libp2p/peeraddrpolicy
# override nim-libp2p default value (which is also 1)
# override nim-libp2p default values (which are also 50 & 1)
const MaxConnections* = 50
const MaxConnectionsPerPeer* = 1
proc withWsTransport*(b: SwitchBuilder): SwitchBuilder =
@ -67,8 +68,8 @@ proc newWakuSwitch*(
inTimeout: Duration = 5.minutes,
outTimeout: Duration = 5.minutes,
maxConnections = MaxConnections,
maxIn = -1,
maxOut = -1,
maxIn = int.high,
maxOut = int.high,
maxConnsPerPeer = MaxConnectionsPerPeer,
nameResolver: NameResolver = nil,
sendSignedPeerRecord = false,
@ -90,8 +91,7 @@ proc newWakuSwitch*(
.new()
.withRng(rng)
.withMaxConnections(maxConnections)
.withMaxIn(maxIn)
.withMaxOut(maxOut)
.withMaxInOut(maxIn, maxOut)
.withMaxConnsPerPeer(maxConnsPerPeer)
.withYamux()
.withMplex(inTimeout, outTimeout)