mirror of
https://github.com/logos-storage/libp2p-storage-mix-transport.git
synced 2026-07-31 04:33:12 +00:00
use new interface to encode destination read behavior in the payload
This commit is contained in:
parent
ad20e03d56
commit
c499bf320c
@ -7,7 +7,7 @@ entryPoints = @["mix_ping_tcp.nim", "mix_ping_quic.nim"]
|
||||
|
||||
requires "nim >= 2.0.0"
|
||||
requires "libp2p == 1.15.3"
|
||||
requires "https://github.com/logos-co/nim-libp2p-mix.git#feat/mix-read-behavior"
|
||||
requires "https://github.com/logos-co/nim-libp2p-mix.git#mix-read-behavior-option-1"
|
||||
requires "chronicles >= 0.11.0"
|
||||
requires "chronos >= 4.2.2"
|
||||
requires "results >= 0.5.0"
|
||||
|
||||
@ -103,8 +103,6 @@ proc mixPingSimulation() {.async: (raises: [Exception]).} =
|
||||
# Populate nodePool with all other nodes' public info
|
||||
proto.nodePool.add(resolvedInfos.includeAllExcept(nodeInfo))
|
||||
|
||||
# Register how to read ping responses (32 bytes exactly)
|
||||
proto.registerDestReadBehavior(PingCodec, readExactly(32))
|
||||
switch.mount(proto)
|
||||
|
||||
mixProtos.add(proto)
|
||||
@ -133,7 +131,12 @@ proc mixPingSimulation() {.async: (raises: [Exception]).} =
|
||||
.toConnection(
|
||||
MixDestination.init(destNode.peerInfo.peerId, destNode.peerInfo.addrs[0]),
|
||||
PingCodec,
|
||||
MixParameters(expectReply: Opt.some(true), numSurbs: Opt.some(byte(1))),
|
||||
MixParameters(
|
||||
expectReply: Opt.some(true),
|
||||
numSurbs: Opt.some(byte(1)),
|
||||
readMethod: Opt.some(ReadExactly),
|
||||
readLimit: Opt.some(32),
|
||||
),
|
||||
)
|
||||
.expect("could not build connection")
|
||||
|
||||
|
||||
@ -23,6 +23,8 @@ import libp2p/[
|
||||
]
|
||||
import libp2p_mix
|
||||
import libp2p_mix/mix_protocol
|
||||
import libp2p_mix
|
||||
import libp2p_mix/mix_protocol
|
||||
|
||||
const NumMixNodes = 10
|
||||
|
||||
@ -84,8 +86,6 @@ proc mixPingSimulation() {.async: (raises: [Exception]).} =
|
||||
# Populate nodePool with all other nodes' public info
|
||||
proto.nodePool.add(resolvedInfos.includeAllExcept(nodeInfo))
|
||||
|
||||
# Register how to read ping responses (32 bytes exactly)
|
||||
proto.registerDestReadBehavior(PingCodec, readExactly(32))
|
||||
switch.mount(proto)
|
||||
|
||||
mixProtos.add(proto)
|
||||
@ -113,7 +113,12 @@ proc mixPingSimulation() {.async: (raises: [Exception]).} =
|
||||
.toConnection(
|
||||
MixDestination.init(destNode.peerInfo.peerId, destNode.peerInfo.addrs[0]),
|
||||
PingCodec,
|
||||
MixParameters(expectReply: Opt.some(true), numSurbs: Opt.some(byte(1))),
|
||||
MixParameters(
|
||||
expectReply: Opt.some(true),
|
||||
numSurbs: Opt.some(byte(1)),
|
||||
readMethod: Opt.some(ReadExactly),
|
||||
readLimit: Opt.some(32),
|
||||
),
|
||||
)
|
||||
.expect("could not build connection")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user