send discovery off into its own goroutine

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
Jeromy 2016-09-15 00:39:38 -07:00
parent 5a920361e3
commit aeebe48c2c

View File

@ -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{