fix: need to run OnNewPeer in a goroutine

This commit is contained in:
Derrick Hammer 2024-01-09 08:39:52 -05:00
parent ed2a47fca3
commit ff1db75f14
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 9 additions and 1 deletions

View File

@ -205,7 +205,15 @@ func (p *P2PImpl) ConnectToNode(connectionUris []*url.URL, retried bool) error {
}
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 {