mirror of https://github.com/vacp2p/nim-libp2p.git
Fix testdaemon.nim.
This commit is contained in:
parent
53467d028f
commit
77f34af737
|
@ -28,7 +28,7 @@ proc main() {.async.} =
|
||||||
ticket: PubsubTicket,
|
ticket: PubsubTicket,
|
||||||
message: PubSubMessage): Future[bool] {.async.} =
|
message: PubSubMessage): Future[bool] {.async.} =
|
||||||
let msglen = len(message.data)
|
let msglen = len(message.data)
|
||||||
echo "= Recieved pubsub message wit length ", msglen,
|
echo "= Recieved pubsub message with length ", msglen,
|
||||||
" bytes from peer ", message.peer.pretty()
|
" bytes from peer ", message.peer.pretty()
|
||||||
echo dumpHex(message.data)
|
echo dumpHex(message.data)
|
||||||
await api.dumpSubscribedPeers()
|
await api.dumpSubscribedPeers()
|
||||||
|
|
|
@ -16,8 +16,10 @@ proc main(bn: string) {.async.} =
|
||||||
ticket: PubsubTicket,
|
ticket: PubsubTicket,
|
||||||
message: PubSubMessage): Future[bool] {.async.} =
|
message: PubSubMessage): Future[bool] {.async.} =
|
||||||
let msglen = len(message.data)
|
let msglen = len(message.data)
|
||||||
echo "= Recieved pubsub message wit length ", msglen,
|
echo "= Recieved pubsub message with length ", msglen,
|
||||||
" bytes from peer ", message.peer.pretty()
|
" bytes from peer ", message.peer.pretty(), ": "
|
||||||
|
var strdata = cast[string](message.data)
|
||||||
|
echo strdata
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
var ticket = await api.pubsubSubscribe("test-net", pubsubLogger)
|
var ticket = await api.pubsubSubscribe("test-net", pubsubLogger)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
import chronos
|
import chronos
|
||||||
import ../libp2p/daemon/daemonapi, ../libp2p/multiaddress, ../libp2p/multicodec,
|
import ../libp2p/daemon/daemonapi, ../libp2p/multiaddress, ../libp2p/multicodec,
|
||||||
../libp2p/cid, ../libp2p/multihash
|
../libp2p/cid, ../libp2p/multihash, ../libp2p/peer
|
||||||
|
|
||||||
proc identitySpawnTest(): Future[bool] {.async.} =
|
proc identitySpawnTest(): Future[bool] {.async.} =
|
||||||
var api = await newDaemonApi()
|
var api = await newDaemonApi()
|
||||||
|
|
Loading…
Reference in New Issue