fix: need to run OnNewPeer in a goroutine
This commit is contained in:
parent
ed2a47fca3
commit
ff1db75f14
|
@ -205,7 +205,15 @@ func (p *P2PImpl) ConnectToNode(connectionUris []*url.URL, retried bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
peer.SetId(id)
|
peer.SetId(id)
|
||||||
return p.OnNewPeer(peer, true)
|
|
||||||
|
go func() {
|
||||||
|
err := p.OnNewPeer(peer, true)
|
||||||
|
if err != nil {
|
||||||
|
p.logger.Error("failed to add peer", zap.Error(err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *P2PImpl) OnNewPeer(peer net.Peer, verifyId bool) error {
|
func (p *P2PImpl) OnNewPeer(peer net.Peer, verifyId bool) error {
|
||||||
|
|
Loading…
Reference in New Issue