internal/socket: simplify nested if-blocks

Change-Id: I9f5fa605d9dc4047f916d9adc998ed23a65839ed
Reviewed-on: https://go-review.googlesource.com/c/148357
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/internal/socket/sys_posix.go b/internal/socket/sys_posix.go
index 646cc2d..9a9bc47 100644
--- a/internal/socket/sys_posix.go
+++ b/internal/socket/sys_posix.go
@@ -154,15 +154,13 @@
 	zoneCache.RLock()
 	name, ok := zoneCache.toName[zone]
 	zoneCache.RUnlock()
-	if !ok {
-		if !updated {
-			zoneCache.update(nil, true)
-			zoneCache.RLock()
-			name, ok = zoneCache.toName[zone]
-			zoneCache.RUnlock()
-		}
+	if !ok && !updated {
+		zoneCache.update(nil, true)
+		zoneCache.RLock()
+		name, ok = zoneCache.toName[zone]
+		zoneCache.RUnlock()
 	}
-	if !ok {
+	if !ok { // last resort
 		name = strconv.Itoa(zone)
 	}
 	return name
@@ -173,15 +171,13 @@
 	zoneCache.RLock()
 	index, ok := zoneCache.toIndex[zone]
 	zoneCache.RUnlock()
-	if !ok {
-		if !updated {
-			zoneCache.update(nil, true)
-			zoneCache.RLock()
-			index, ok = zoneCache.toIndex[zone]
-			zoneCache.RUnlock()
-		}
+	if !ok && !updated {
+		zoneCache.update(nil, true)
+		zoneCache.RLock()
+		index, ok = zoneCache.toIndex[zone]
+		zoneCache.RUnlock()
 	}
-	if !ok {
+	if !ok { // last resort
 		index, _ = strconv.Atoi(zone)
 	}
 	return index