mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
swarm/network: Wait in processDeliveries until hash is ready
This commit is contained in:
parent
2efb994c19
commit
1c7805bde4
1 changed files with 3 additions and 1 deletions
|
|
@ -72,11 +72,13 @@ func NewRetrieveRequestStreamer(db *DbAccess) *RetrieveRequestStreamer {
|
||||||
// processDeliveries handles delivered chunk hashes
|
// processDeliveries handles delivered chunk hashes
|
||||||
func (s *RetrieveRequestStreamer) processDeliveries() {
|
func (s *RetrieveRequestStreamer) processDeliveries() {
|
||||||
var hashes []byte
|
var hashes []byte
|
||||||
|
var batchC chan []byte
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case delivery := <-s.deliveryC:
|
case delivery := <-s.deliveryC:
|
||||||
hashes = append(hashes, delivery.Key[:]...)
|
hashes = append(hashes, delivery.Key[:]...)
|
||||||
case s.batchC <- hashes:
|
batchC = s.batchC
|
||||||
|
case batchC <- hashes:
|
||||||
hashes = nil
|
hashes = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue