Use for to iterate over channel
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
74e577610a
commit
ba9678bd61
@ -42,12 +42,9 @@ func newPeerTracker(lc fx.Lifecycle, h host.Host, pmgr *peermgr.PeerMgr) *bsPeer
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
var newPeer interface{}
|
for newPeer := range sub.Out() {
|
||||||
ok := true
|
|
||||||
for ok {
|
|
||||||
newPeer, ok = <-sub.Out()
|
|
||||||
log.Warnf("new peer from hello in tracker: %s", newPeer.(peermgr.NewFilPeer).Id)
|
|
||||||
bsPt.addPeer(newPeer.(peermgr.NewFilPeer).Id)
|
bsPt.addPeer(newPeer.(peermgr.NewFilPeer).Id)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user