File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,17 +170,9 @@ func (m *MHMap) Refresh() (n int64) {
170170 }
171171
172172 for _ , h := range hs {
173+ m .Del (h )
173174 n += int64 (h .Refresh ())
174- }
175-
176- m .Lock ()
177- defer m .Unlock ()
178- for _ , h := range hs {
179- // reindex new addrs
180- if _ , ok := m .uniq [h ]; ok {
181- m .delLocked (h )
182- m .putLocked (h )
183- }
175+ m .Put (h )
184176 }
185177 return
186178}
@@ -196,29 +188,21 @@ func (m *MHMap) MaybeRefresh() (n int64) {
196188 return
197189 }
198190
199- var staleHs []* MH
191+ var stale []* MH
200192 for h := range m .cloneset () {
201- if _ , stale := h .stale (); stale {
202- staleHs = append (staleHs , h )
193+ if _ , old := h .stale (); old {
194+ stale = append (stale , h )
203195 }
204196 }
205197
206- if len (staleHs ) == 0 {
198+ if len (stale ) == 0 {
207199 return
208200 }
209201
210- for _ , h := range staleHs {
202+ for _ , h := range stale {
203+ m .Del (h )
211204 n += int64 (h .Refresh ())
212- }
213-
214- m .Lock ()
215- defer m .Unlock ()
216- for _ , h := range staleHs {
217- // reindex new addrs
218- if _ , ok := m .uniq [h ]; ok {
219- m .delLocked (h )
220- m .putLocked (h )
221- }
205+ m .Put (h )
222206 }
223207 return
224208}
You can’t perform that action at this time.
0 commit comments