mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-30 00:23:46 +00:00
fix:make offered content async gossip
Signed-off-by: Chen Kai <281165273grape@gmail.com>
This commit is contained in:
parent
e97bca61ec
commit
be7fc977c4
2 changed files with 29 additions and 12 deletions
|
|
@ -240,12 +240,20 @@ func (bn *BeaconNetwork) processContentLoop(ctx context.Context) {
|
|||
bn.log.Error("validate content failed", "err", err)
|
||||
continue
|
||||
}
|
||||
gossippedNum, err := bn.portalProtocol.Gossip(&contentElement.Node, contentElement.ContentKeys, contentElement.Contents)
|
||||
bn.log.Trace("gossippedNum", "gossippedNum", gossippedNum)
|
||||
if err != nil {
|
||||
bn.log.Error("gossip failed", "err", err)
|
||||
continue
|
||||
}
|
||||
go func(ctx context.Context) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
var gossippedNum int
|
||||
gossippedNum, err = bn.portalProtocol.Gossip(&contentElement.Node, contentElement.ContentKeys, contentElement.Contents)
|
||||
bn.log.Trace("gossippedNum", "gossippedNum", gossippedNum)
|
||||
if err != nil {
|
||||
bn.log.Error("gossip failed", "err", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}(ctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -508,12 +508,21 @@ func (h *HistoryNetwork) processContentLoop(ctx context.Context) {
|
|||
h.log.Error("validate content failed", "err", err)
|
||||
continue
|
||||
}
|
||||
gossippedNum, err := h.portalProtocol.Gossip(&contentElement.Node, contentElement.ContentKeys, contentElement.Contents)
|
||||
h.log.Trace("gossippedNum", "gossippedNum", gossippedNum)
|
||||
if err != nil {
|
||||
h.log.Error("gossip failed", "err", err)
|
||||
continue
|
||||
}
|
||||
|
||||
go func(ctx context.Context) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
var gossippedNum int
|
||||
gossippedNum, err = h.portalProtocol.Gossip(&contentElement.Node, contentElement.ContentKeys, contentElement.Contents)
|
||||
h.log.Trace("gossippedNum", "gossippedNum", gossippedNum)
|
||||
if err != nil {
|
||||
h.log.Error("gossip failed", "err", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}(ctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue