Skip to content

Commit 60d07de

Browse files
janoszelig
authored andcommitted
storage: fix possible hasherstore deadlock on waitC channel (ethersphere#1674)
1 parent c535b27 commit 60d07de

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

storage/hasherstore.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ func (h *hasherStore) startWait(ctx context.Context) {
153153
// if context is done earlier, just return with the error
154154
case <-ctx.Done():
155155
h.waitC <- ctx.Err()
156+
return
156157
// doneC is closed if all chunks have been submitted, from then we just wait until all of them are also stored
157158
case <-doneC:
158159
done = true
@@ -161,6 +162,7 @@ func (h *hasherStore) startWait(ctx context.Context) {
161162
case err := <-h.errC:
162163
if err != nil {
163164
h.waitC <- err
165+
return
164166
}
165167
nrStoredChunks++
166168
}

0 commit comments

Comments
 (0)