mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 15:33:47 +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)
|
bn.log.Error("validate content failed", "err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
gossippedNum, err := bn.portalProtocol.Gossip(&contentElement.Node, contentElement.ContentKeys, contentElement.Contents)
|
go func(ctx context.Context) {
|
||||||
bn.log.Trace("gossippedNum", "gossippedNum", gossippedNum)
|
select {
|
||||||
if err != nil {
|
case <-ctx.Done():
|
||||||
bn.log.Error("gossip failed", "err", err)
|
return
|
||||||
continue
|
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)
|
h.log.Error("validate content failed", "err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
gossippedNum, err := h.portalProtocol.Gossip(&contentElement.Node, contentElement.ContentKeys, contentElement.Contents)
|
|
||||||
h.log.Trace("gossippedNum", "gossippedNum", gossippedNum)
|
go func(ctx context.Context) {
|
||||||
if err != nil {
|
select {
|
||||||
h.log.Error("gossip failed", "err", err)
|
case <-ctx.Done():
|
||||||
continue
|
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