Quellcode durchsuchen

remove debug logs

Max Ma vor 9 Monaten
Ursprung
Commit
57d4c40ba4
4 geänderte Dateien mit 0 neuen und 31 gelöschten Zeilen
  1. 0 6
      controllers/hosts.go
  2. 0 6
      logic/hosts.go
  3. 0 7
      mq/handlers.go
  4. 0 12
      mq/publishers.go

+ 0 - 6
controllers/hosts.go

@@ -319,9 +319,6 @@ func hostUpdateFallback(w http.ResponseWriter, r *http.Request) {
 	switch hostUpdate.Action {
 	case models.CheckIn:
 		sendPeerUpdate = mq.HandleHostCheckin(&hostUpdate.Host, currentHost)
-		if sendPeerUpdate {
-			slog.Error("sendPeerUpdate from CheckIn", "Debug", sendPeerUpdate, &hostUpdate.Host.Name, &hostUpdate.Host.ID)
-		}
 
 	case models.UpdateHost:
 		if hostUpdate.Host.PublicKey != currentHost.PublicKey {
@@ -329,9 +326,6 @@ func hostUpdateFallback(w http.ResponseWriter, r *http.Request) {
 			replacePeers = true
 		}
 		sendPeerUpdate = logic.UpdateHostFromClient(&hostUpdate.Host, currentHost)
-		if sendPeerUpdate {
-			slog.Error("sendPeerUpdate from UpdateHost", "Debug", sendPeerUpdate, &hostUpdate.Host.Name, &hostUpdate.Host.ID)
-		}
 		err := logic.UpsertHost(currentHost)
 		if err != nil {
 			slog.Error("failed to update host", "id", currentHost.ID, "error", err)

+ 0 - 6
logic/hosts.go

@@ -243,30 +243,25 @@ func UpdateHost(newHost, currentHost *models.Host) {
 // UpdateHostFromClient - used for updating host on server with update recieved from client
 func UpdateHostFromClient(newHost, currHost *models.Host) (sendPeerUpdate bool) {
 	if newHost.PublicKey != currHost.PublicKey {
-		slog.Error("PublicKey changed:", "Debug")
 		currHost.PublicKey = newHost.PublicKey
 		sendPeerUpdate = true
 	}
 	if newHost.ListenPort != 0 && currHost.ListenPort != newHost.ListenPort {
-		slog.Error("ListenPort changed:", "Debug", currHost.ListenPort, newHost.ListenPort)
 		currHost.ListenPort = newHost.ListenPort
 		sendPeerUpdate = true
 	}
 	if newHost.WgPublicListenPort != 0 &&
 		currHost.WgPublicListenPort != newHost.WgPublicListenPort {
-		slog.Error("WgPublicListenPort changed:", "Debug", currHost.WgPublicListenPort, newHost.WgPublicListenPort)
 		currHost.WgPublicListenPort = newHost.WgPublicListenPort
 		sendPeerUpdate = true
 	}
 	isEndpointChanged := false
 	if currHost.EndpointIP.String() != newHost.EndpointIP.String() {
-		slog.Error("EndpointIP changed:", "Debug", currHost.EndpointIP, newHost.EndpointIP)
 		currHost.EndpointIP = newHost.EndpointIP
 		sendPeerUpdate = true
 		isEndpointChanged = true
 	}
 	if currHost.EndpointIPv6.String() != newHost.EndpointIPv6.String() {
-		slog.Error("EndpointIPv6 changed:", "Debug", currHost.EndpointIPv6, newHost.EndpointIPv6)
 		currHost.EndpointIPv6 = newHost.EndpointIPv6
 		sendPeerUpdate = true
 		isEndpointChanged = true
@@ -295,7 +290,6 @@ func UpdateHostFromClient(newHost, currHost *models.Host) (sendPeerUpdate bool)
 
 	currHost.Name = newHost.Name
 	if len(newHost.NatType) > 0 && newHost.NatType != currHost.NatType {
-		slog.Error("NatType changed:", "Debug", currHost.NatType, newHost.NatType)
 		currHost.NatType = newHost.NatType
 		sendPeerUpdate = true
 	}

+ 0 - 7
mq/handlers.go

@@ -106,10 +106,6 @@ func UpdateHost(client mqtt.Client, msg mqtt.Message) {
 	switch hostUpdate.Action {
 	case models.CheckIn:
 		sendPeerUpdate = HandleHostCheckin(&hostUpdate.Host, currentHost)
-		if sendPeerUpdate {
-			slog.Error("sendPeerUpdate from UpdateHost.CheckIn", "Debug", sendPeerUpdate, &hostUpdate.Host.Name, &hostUpdate.Host.ID)
-		}
-
 	case models.Acknowledgement:
 		hu := hostactions.GetAction(currentHost.ID.String())
 		if hu != nil {
@@ -133,9 +129,6 @@ func UpdateHost(client mqtt.Client, msg mqtt.Message) {
 			replacePeers = true
 		}
 		sendPeerUpdate = logic.UpdateHostFromClient(&hostUpdate.Host, currentHost)
-		if sendPeerUpdate {
-			slog.Error("sendPeerUpdate from UpdateHost.UpdateHost", "Debug", sendPeerUpdate, &hostUpdate.Host.Name, &hostUpdate.Host.ID)
-		}
 		err := logic.UpsertHost(currentHost)
 		if err != nil {
 			slog.Error("failed to update host", "id", currentHost.ID, "error", err)

+ 0 - 12
mq/publishers.go

@@ -4,7 +4,6 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
-	"runtime"
 	"sync"
 	"time"
 
@@ -20,21 +19,11 @@ var running bool
 
 // PublishPeerUpdate --- determines and publishes a peer update to all the hosts
 func PublishPeerUpdate(replacePeers bool) error {
-	slog.Error("entering PublishPeerUpdate", "Debug")
 	if running {
 		return nil
 	}
 	running = true
-	t1 := time.Now().Unix()
 
-	pc, file, no, ok := runtime.Caller(1)
-	if ok {
-		slog.Error("called from ", file, no)
-	}
-	details := runtime.FuncForPC(pc)
-	if ok && details != nil {
-		slog.Error("called from ", details.Name())
-	}
 	if !servercfg.IsMessageQueueBackend() {
 		return nil
 	}
@@ -67,7 +56,6 @@ func PublishPeerUpdate(replacePeers bool) error {
 		}(host)
 	}
 	running = false
-	slog.Error("leaving PublishPeerUpdate, time cost: ", "Debug", time.Now().Unix()-t1)
 	return nil
 }