Przeglądaj źródła

revert debug changes

Abhishek Kondur 1 rok temu
rodzic
commit
f132878e0d
2 zmienionych plików z 5 dodań i 17 usunięć
  1. 0 4
      mq/publishers.go
  2. 5 13
      mq/util.go

+ 0 - 4
mq/publishers.go

@@ -143,10 +143,6 @@ func HostUpdate(hostUpdate *models.HostUpdate) error {
 		logger.Log(2, "error marshalling node update ", err.Error())
 		return err
 	}
-	if hostUpdate.Action == models.SignalHost {
-		encrypted, encryptErr := encryptMsg(&hostUpdate.Host, data)
-		fmt.Println("------------> SINGAL MQ  MSG: ", len(encrypted), encryptErr)
-	}
 	if err = publish(&hostUpdate.Host, fmt.Sprintf("host/update/%s/%s", hostUpdate.Host.ID.String(), servercfg.GetServer()), data); err != nil {
 		logger.Log(2, "error publishing host update to", hostUpdate.Host.ID.String(), err.Error())
 		return err

+ 5 - 13
mq/util.go

@@ -3,7 +3,6 @@ package mq
 import (
 	"errors"
 	"fmt"
-	"runtime"
 	"strings"
 	"time"
 
@@ -74,23 +73,16 @@ func encryptMsg(host *models.Host, msg []byte) ([]byte, error) {
 }
 
 func publish(host *models.Host, dest string, msg []byte) error {
-	if len(msg) == 0 {
-		fmt.Println("----->  $$$$$$ ZERO MSG_-------> ", string(msg))
-		pc, _, _, ok := runtime.Caller(1)
-		details := runtime.FuncForPC(pc)
-		if ok && details != nil {
-			fmt.Printf("\n------> ####$$$ Called from %s\n", details.Name())
-		}
+
+	encrypted, encryptErr := encryptMsg(host, msg)
+	if encryptErr != nil {
+		return encryptErr
 	}
-	// encrypted, encryptErr := encryptMsg(host, msg)
-	// if encryptErr != nil {
-	// 	return encryptErr
-	// }
 	if mqclient == nil {
 		return errors.New("cannot publish ... mqclient not connected")
 	}
 
-	if token := mqclient.Publish(dest, 0, true, msg); !token.WaitTimeout(MQ_TIMEOUT*time.Second) || token.Error() != nil {
+	if token := mqclient.Publish(dest, 0, true, encrypted); !token.WaitTimeout(MQ_TIMEOUT*time.Second) || token.Error() != nil {
 		var err error
 		if token.Error() == nil {
 			err = errors.New("connection timeout")