File tree 1 file changed +12
-16
lines changed 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -223,15 +223,13 @@ func (zc *ipv6ZoneCache) name(index int) string {
223
223
zoneCache .RLock ()
224
224
name , ok := zoneCache .toName [index ]
225
225
zoneCache .RUnlock ()
226
- if ! ok {
227
- if ! updated {
228
- zoneCache .update (nil , true )
229
- zoneCache .RLock ()
230
- name , ok = zoneCache .toName [index ]
231
- zoneCache .RUnlock ()
232
- }
226
+ if ! ok && ! updated {
227
+ zoneCache .update (nil , true )
228
+ zoneCache .RLock ()
229
+ name , ok = zoneCache .toName [index ]
230
+ zoneCache .RUnlock ()
233
231
}
234
- if ! ok {
232
+ if ! ok { // last resort
235
233
name = uitoa (uint (index ))
236
234
}
237
235
return name
@@ -245,15 +243,13 @@ func (zc *ipv6ZoneCache) index(name string) int {
245
243
zoneCache .RLock ()
246
244
index , ok := zoneCache .toIndex [name ]
247
245
zoneCache .RUnlock ()
248
- if ! ok {
249
- if ! updated {
250
- zoneCache .update (nil , true )
251
- zoneCache .RLock ()
252
- index , ok = zoneCache .toIndex [name ]
253
- zoneCache .RUnlock ()
254
- }
246
+ if ! ok && ! updated {
247
+ zoneCache .update (nil , true )
248
+ zoneCache .RLock ()
249
+ index , ok = zoneCache .toIndex [name ]
250
+ zoneCache .RUnlock ()
255
251
}
256
- if ! ok {
252
+ if ! ok { // last resort
257
253
index , _ , _ = dtoi (name )
258
254
}
259
255
return index
You can’t perform that action at this time.
0 commit comments