瀏覽代碼

review comments

Matthew R Kasun 2 年之前
父節點
當前提交
d0af730042
共有 1 個文件被更改,包括 2 次插入5 次删除
  1. 2 5
      logic/hosts.go

+ 2 - 5
logic/hosts.go

@@ -331,7 +331,7 @@ func CheckHostPorts(h *models.Host) {
 }
 
 func checkPort(h *models.Host, p int) int {
-	currentPort := h.ListenPort
+	currentPort := p
 	count := 0
 	hosts, err := GetAllHosts()
 	if err != nil {
@@ -361,10 +361,7 @@ func checkPort(h *models.Host, p int) int {
 // HostExists - checks if given host already exists
 func HostExists(h *models.Host) bool {
 	_, err := GetHost(h.ID.String())
-	if (err != nil && !database.IsEmptyRecord(err)) || (err == nil) {
-		return true
-	}
-	return false
+	return (err != nil && !database.IsEmptyRecord(err)) || (err == nil)
 }
 
 func updatePort(p *int) {