mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
send discovery off into its own goroutine
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
parent
5a920361e3
commit
aeebe48c2c
@ -105,14 +105,16 @@ To use, the daemon must be run with '--enable-pubsub-experiment'.
|
||||
|
||||
discover, _, _ := req.Option("discover").Bool()
|
||||
if discover {
|
||||
blk := blocks.NewBlock([]byte("floodsub:" + topic))
|
||||
cid, err := n.Blocks.AddObject(blk)
|
||||
if err != nil {
|
||||
log.Error("pubsub discovery: ", err)
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
blk := blocks.NewBlock([]byte("floodsub:" + topic))
|
||||
cid, err := n.Blocks.AddObject(blk)
|
||||
if err != nil {
|
||||
log.Error("pubsub discovery: ", err)
|
||||
return
|
||||
}
|
||||
|
||||
connectToPubSubPeers(req.Context(), n, cid)
|
||||
connectToPubSubPeers(req.Context(), n, cid)
|
||||
}()
|
||||
}
|
||||
},
|
||||
Marshalers: cmds.MarshalerMap{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user