File tree Expand file tree Collapse file tree 4 files changed +32
-0
lines changed
Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ type Puller struct {
2525 chunkIndexesLock sync.Mutex
2626 nextChunk int64
2727 nextChunkAndFinalizedLock sync.Mutex
28+
29+ closeLock sync.Mutex
2830}
2931
3032func NewPuller (
@@ -165,6 +167,9 @@ func (p *Puller) Wait() error {
165167 go func () {
166168 p .workersWg .Wait ()
167169
170+ p .closeLock .Lock ()
171+ defer p .closeLock .Unlock ()
172+
168173 if p .errs != nil {
169174 close (p .errs )
170175
Original file line number Diff line number Diff line change @@ -111,6 +111,9 @@ func (s *FileMigrator) Seed() (
111111 return
112112 }
113113
114+ s .closeLock .Lock ()
115+ defer s .closeLock .Unlock ()
116+
114117 if s .errs != nil {
115118 close (s .errs )
116119
@@ -173,6 +176,9 @@ func (s *FileMigrator) Leech(
173176 return
174177 }
175178
179+ s .closeLock .Lock ()
180+ defer s .closeLock .Unlock ()
181+
176182 if ! s .released && s .errs != nil {
177183 close (s .errs )
178184
@@ -238,6 +244,9 @@ func (s *FileMigrator) Leech(
238244 return
239245 }
240246
247+ s .closeLock .Lock ()
248+ defer s .closeLock .Unlock ()
249+
241250 if s .errs != nil {
242251 close (s .errs )
243252
Original file line number Diff line number Diff line change @@ -135,6 +135,9 @@ func (s *PathMigrator) Seed() (
135135 return
136136 }
137137
138+ s .closeLock .Lock ()
139+ defer s .closeLock .Unlock ()
140+
138141 if s .errs != nil {
139142 close (s .errs )
140143
@@ -198,6 +201,9 @@ func (s *PathMigrator) Leech(
198201 return
199202 }
200203
204+ s .closeLock .Lock ()
205+ defer s .closeLock .Unlock ()
206+
201207 if ! s .released && s .errs != nil {
202208 close (s .errs )
203209
@@ -262,6 +268,9 @@ func (s *PathMigrator) Leech(
262268 return
263269 }
264270
271+ s .closeLock .Lock ()
272+ defer s .closeLock .Unlock ()
273+
265274 if s .errs != nil {
266275 close (s .errs )
267276
Original file line number Diff line number Diff line change @@ -110,6 +110,9 @@ func (s *SliceMigrator) Seed() (
110110 return
111111 }
112112
113+ s .closeLock .Lock ()
114+ defer s .closeLock .Unlock ()
115+
113116 if s .errs != nil {
114117 close (s .errs )
115118
@@ -172,6 +175,9 @@ func (s *SliceMigrator) Leech(
172175 return
173176 }
174177
178+ s .closeLock .Lock ()
179+ defer s .closeLock .Unlock ()
180+
175181 if ! s .released && s .errs != nil {
176182 close (s .errs )
177183
@@ -237,6 +243,9 @@ func (s *SliceMigrator) Leech(
237243 return
238244 }
239245
246+ s .closeLock .Lock ()
247+ defer s .closeLock .Unlock ()
248+
240249 if s .errs != nil {
241250 close (s .errs )
242251
You can’t perform that action at this time.
0 commit comments