From 1223965cd43a50b96e7f76f78d936f6995370b65 Mon Sep 17 00:00:00 2001
From: Aleksey Dmitrevskiy <ad@adguard.com>
Date: Wed, 27 Feb 2019 16:42:50 +0300
Subject: [PATCH] Code simplify

---
 control.go | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/control.go b/control.go
index dd368380..e5d88082 100644
--- a/control.go
+++ b/control.go
@@ -354,23 +354,19 @@ func setDNSServers(w *http.ResponseWriter, r *http.Request, upstreams bool) {
 	}
 
 	// count of upstream or bootstrap servers
-	var count int
-	if upstreams {
-		count = len(hosts)
-	} else {
+	count := len(hosts)
+	if !upstreams {
 		count = len(bootstraps)
 	}
 
 	if upstreams {
-		if count == 0 {
-			config.DNS.UpstreamDNS = defaultDNS
-		} else {
+		config.DNS.UpstreamDNS = defaultDNS
+		if count != 0 {
 			config.DNS.UpstreamDNS = hosts
 		}
 	} else {
-		if count == 0 {
-			config.DNS.BootstrapDNS = defaultBootstrap
-		} else {
+		config.DNS.BootstrapDNS = defaultBootstrap
+		if count != 0 {
 			config.DNS.BootstrapDNS = bootstraps
 		}
 	}