Remove unnecessary wg from Chunk

This commit is contained in:
Balint Gabor 2018-01-04 12:20:31 +01:00
parent 4e0303f782
commit 772153a4b4
2 changed files with 7 additions and 15 deletions

View file

@ -43,14 +43,8 @@ func NewLocalStore(hash SwarmHasher, params *StoreParams, basekey []byte) (*Loca
// unsafe, in that the data is not integrity checked // unsafe, in that the data is not integrity checked
func (self *LocalStore) Put(chunk *Chunk) { func (self *LocalStore) Put(chunk *Chunk) {
self.memStore.Put(chunk) self.memStore.Put(chunk)
if chunk.wg != nil {
chunk.wg.Add(1)
}
go func() { go func() {
self.DbStore.Put(chunk) self.DbStore.Put(chunk)
if chunk.wg != nil {
chunk.wg.Done()
}
}() }()
} }

View file

@ -24,7 +24,6 @@ import (
"fmt" "fmt"
"hash" "hash"
"io" "io"
"sync"
"github.com/ethereum/go-ethereum/bmt" "github.com/ethereum/go-ethereum/bmt"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -200,7 +199,6 @@ type Chunk struct {
Source Peer // peer Source Peer // peer
C chan bool // to signal data delivery by the dpa C chan bool // to signal data delivery by the dpa
Req *RequestStatus // request Status needed by netStore Req *RequestStatus // request Status needed by netStore
wg *sync.WaitGroup // wg to synchronize
dbStored chan bool // never remove a chunk from memStore before it is written to dbStore dbStored chan bool // never remove a chunk from memStore before it is written to dbStore
} }