Browse Source

check for use turn config

Abhishek Kondur 2 years ago
parent
commit
64c0c861f4
1 changed files with 7 additions and 2 deletions
  1. 7 2
      logic/hosts.go

+ 7 - 2
logic/hosts.go

@@ -219,13 +219,18 @@ func RemoveHost(h *models.Host) error {
 	if len(h.Nodes) > 0 {
 		return fmt.Errorf("host still has associated nodes")
 	}
-	DeRegisterHostWithTurn(h.ID.String())
+	if servercfg.IsUsingTurn() {
+		DeRegisterHostWithTurn(h.ID.String())
+	}
+
 	return database.DeleteRecord(database.HOSTS_TABLE_NAME, h.ID.String())
 }
 
 // RemoveHostByID - removes a given host by id from server
 func RemoveHostByID(hostID string) error {
-	DeRegisterHostWithTurn(hostID)
+	if servercfg.IsUsingTurn() {
+		DeRegisterHostWithTurn(hostID)
+	}
 	return database.DeleteRecord(database.HOSTS_TABLE_NAME, hostID)
 }