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
func (self *LocalStore) Put(chunk *Chunk) {
self.memStore.Put(chunk)
if chunk.wg != nil {
chunk.wg.Add(1)
}
go func() {
self.DbStore.Put(chunk)
if chunk.wg != nil {
chunk.wg.Done()
}
}()
}

View file

@ -24,7 +24,6 @@ import (
"fmt"
"hash"
"io"
"sync"
"github.com/ethereum/go-ethereum/bmt"
"github.com/ethereum/go-ethereum/common"
@ -194,14 +193,13 @@ func NewRequestStatus(key Key) *RequestStatus {
// but the size of the subtree encoded in the chunk
// 0 if request, to be supplied by the dpa
type Chunk struct {
Key Key // always
SData []byte // nil if request, to be supplied by dpa
Size int64 // size of the data covered by the subtree encoded in this chunk
Source Peer // peer
C chan bool // to signal data delivery by the dpa
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
Key Key // always
SData []byte // nil if request, to be supplied by dpa
Size int64 // size of the data covered by the subtree encoded in this chunk
Source Peer // peer
C chan bool // to signal data delivery by the dpa
Req *RequestStatus // request Status needed by netStore
dbStored chan bool // never remove a chunk from memStore before it is written to dbStore
}
func NewChunk(key Key, rs *RequestStatus) *Chunk {