From 2fd50b104c9431a603310800b9ee4d0d44ce9391 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Tue, 31 Oct 2023 12:16:26 -0700 Subject: [PATCH 1/3] check hooks are enabled before firing --- controller/PostgreSQL.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index fd99e0ff2..0ab721dcd 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -1436,7 +1436,21 @@ void PostgreSQL::commitThread() w.commit(); if (_smee != NULL && isNewMember) { - notifyNewMember(networkId, memberId); + pqxx::row row = w.exec_params1( + "SELECT " + " count(h.hook_id) " + "FROM " + " ztc_hook h " + " INNER JOIN ztc_org o ON o.org_id = h.org_id " + " INNER JOIN ztc_network n ON n.owner_id = o.owner_id " + " WHERE " + "n.id = $1 ", + networkId + ); + int64_t hookCount = row[0].as(); + if (hookCount > 0) { + notifyNewMember(networkId, memberId); + } } const uint64_t nwidInt = OSUtils::jsonIntHex(config["nwid"], 0ULL); From a477688e5147ee534efb27f02f21f5db75cd47e1 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Fri, 3 Nov 2023 09:56:40 -0400 Subject: [PATCH 2/3] Remove extra '/' On macOS, dump gives this output: % sudo zerotier-cli dump Writing dump to: /Users/brenton/Desktop//zerotier_dump.txt No reason for extra '/' in path --- one.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/one.cpp b/one.cpp index 4c7dd9cc1..977da1f20 100644 --- a/one.cpp +++ b/one.cpp @@ -1210,7 +1210,7 @@ static int cli(int argc,char **argv) FSRefMakePath(&fsref, path, sizeof(path)) == noErr) { } else if (getenv("SUDO_USER")) { - sprintf((char*)path, "/Users/%s/Desktop/", getenv("SUDO_USER")); + sprintf((char*)path, "/Users/%s/Desktop", getenv("SUDO_USER")); } else { fprintf(stdout, "%s", dump.str().c_str()); return 0; From d37dce508ac3e430099d3ba36f7e755b17f3bb82 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Fri, 17 Nov 2023 14:53:22 -0800 Subject: [PATCH 3/3] don't require temporal for central controller startup --- ext/central-controller-docker/main.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ext/central-controller-docker/main.sh b/ext/central-controller-docker/main.sh index 04778a277..5583b3adc 100755 --- a/ext/central-controller-docker/main.sh +++ b/ext/central-controller-docker/main.sh @@ -100,12 +100,14 @@ else done fi -echo "Waiting for temporal" -while ! nc -z ${ZT_TEMPORAL_HOST} ${ZT_TEMPORAL_PORT}; do - echo "waiting..."; - sleep 1; -done -echo "Temporal is up" +if [ -n "$ZT_TEMPORAL_HOST" ] && [ -n "$ZT_TEMPORAL_PORT" ]; then + echo "waiting for temporal..." + while ! nc -z ${ZT_TEMPORAL_HOST} ${ZT_TEMPORAL_PORT}; do + echo "waiting..."; + sleep 1; + done + echo "Temporal is up" +fi export GLIBCXX_FORCE_NEW=1 export GLIBCPP_FORCE_NEW=1