fixing localport issues

This commit is contained in:
afeiszli
2022-04-21 15:44:43 -04:00
parent ccc0ed851d
commit 5f303cb50a
4 changed files with 8 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"os"
"strconv"
"sync"
"time"
@@ -68,12 +69,11 @@ func Checkin(ctx context.Context, wg *sync.WaitGroup) {
deviceiface = nodeCfg.Node.Interface
}
}
localPort, err := local.GetLocalListenPort(deviceiface)
if err != nil {
logger.Log(1, "error encountered checking private ip addresses: ", err.Error())
}
if nodeCfg.Node.LocalListenPort != localPort && localPort != 0 {
logger.Log(1, "local port has changed from ", string(nodeCfg.Node.LocalListenPort), " to ", string(localPort))
localPort, errN := local.GetLocalListenPort(deviceiface)
if errN != nil {
logger.Log(1, "error encountered checking local listen port: ", err.Error())
} else if nodeCfg.Node.LocalListenPort != localPort && localPort != 0 {
logger.Log(1, "local port has changed from ", strconv.Itoa(int(nodeCfg.Node.LocalListenPort)), " to ", strconv.Itoa(int(localPort)))
nodeCfg.Node.LocalListenPort = localPort
if err := PublishNodeUpdate(&nodeCfg); err != nil {
logger.Log(0, "could not publish local port change")