From 772153a4b41f1e75f4c2b1db2db5d4bf1e1ea480 Mon Sep 17 00:00:00 2001 From: Balint Gabor Date: Thu, 4 Jan 2018 12:20:31 +0100 Subject: [PATCH] Remove unnecessary wg from Chunk --- swarm/storage/localstore.go | 6 ------ swarm/storage/types.go | 16 +++++++--------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/swarm/storage/localstore.go b/swarm/storage/localstore.go index ddc10934d8..c70271a09a 100644 --- a/swarm/storage/localstore.go +++ b/swarm/storage/localstore.go @@ -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() - } }() } diff --git a/swarm/storage/types.go b/swarm/storage/types.go index 000c4a056b..833a1b4262 100644 --- a/swarm/storage/types.go +++ b/swarm/storage/types.go @@ -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 {