parent
0b807e7ee5
commit
9c2b8591d4
|
@ -48,16 +48,16 @@ proc provideBadCidTest(): Future[bool] {.async.} =
|
||||||
finally:
|
finally:
|
||||||
await api.close()
|
await api.close()
|
||||||
|
|
||||||
proc getOnlyOneIPv4Address(addresses: seq[MultiAddress]): seq[MultiAddress] =
|
# proc getOnlyOneIPv4Address(addresses: seq[MultiAddress]): seq[MultiAddress] =
|
||||||
## We doing this becuase of bug in `go-pubsub`
|
# ## We doing this becuase of bug in `go-pubsub`
|
||||||
## https://github.com/libp2p/go-libp2p-pubsub/issues/130
|
# ## https://github.com/libp2p/go-libp2p-pubsub/issues/130
|
||||||
if len(addresses) > 0:
|
# if len(addresses) > 0:
|
||||||
result = newSeqOfCap[MultiAddress](len(addresses))
|
# result = newSeqOfCap[MultiAddress](len(addresses))
|
||||||
let ip4 = multiCodec("ip4")
|
# let ip4 = multiCodec("ip4")
|
||||||
for item in addresses:
|
# for item in addresses:
|
||||||
if item.protoCode() == ip4:
|
# if item.protoCode() == ip4:
|
||||||
result.add(item)
|
# result.add(item)
|
||||||
break
|
# break
|
||||||
|
|
||||||
proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} =
|
proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} =
|
||||||
var pubsubData = "TEST MESSAGE"
|
var pubsubData = "TEST MESSAGE"
|
||||||
|
@ -95,10 +95,8 @@ proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} =
|
||||||
# Callback must return `false` to close subscription channel.
|
# Callback must return `false` to close subscription channel.
|
||||||
result = false
|
result = false
|
||||||
|
|
||||||
# Not subscribed to any topics everything must be 0.
|
await api1.connect(id2.peer, id2.addresses)
|
||||||
# We are making only one connection, because of bug
|
await api2.connect(id1.peer, id1.addresses)
|
||||||
# https://github.com/libp2p/go-libp2p-pubsub/issues/130
|
|
||||||
await api1.connect(id2.peer, getOnlyOneIPv4Address(id2.addresses))
|
|
||||||
|
|
||||||
var ticket1 = await api1.pubsubSubscribe("test-topic", pubsubHandler1)
|
var ticket1 = await api1.pubsubSubscribe("test-topic", pubsubHandler1)
|
||||||
var ticket2 = await api2.pubsubSubscribe("test-topic", pubsubHandler2)
|
var ticket2 = await api2.pubsubSubscribe("test-topic", pubsubHandler2)
|
||||||
|
|
Loading…
Reference in New Issue