check host ports on join

This commit is contained in:
Matthew R Kasun
2023-01-18 15:55:24 -05:00
parent d7b6baceb2
commit 1f92d06d7c
2 changed files with 53 additions and 0 deletions

View File

@@ -579,6 +579,9 @@ func createNode(w http.ResponseWriter, r *http.Request) {
// consume password before hashing for mq client creation
hostPassword := data.Host.HostPass
data.Node.Server = servercfg.GetServer()
if !logic.HostExists(&data.Host) {
logic.CheckHostPorts(&data.Host)
}
if err := logic.CreateHost(&data.Host); err != nil {
if errors.Is(err, logic.ErrHostExists) {
logger.Log(3, "host exists .. no need to create")