summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Limberg <[email protected]>2023-11-20 08:16:10 -0800
committerGitHub <[email protected]>2023-11-20 08:16:10 -0800
commit663ed73768a895a8681b6ec57059109073adf8f9 (patch)
tree041d277be72e51228e91c660ddb0ae9384156eaa
parenta477688e5147ee534efb27f02f21f5db75cd47e1 (diff)
parentd37dce508ac3e430099d3ba36f7e755b17f3bb82 (diff)
Merge pull request #2165 from zerotier/network-checkHEADdev
check hooks are enabled before firing
-rw-r--r--controller/PostgreSQL.cpp16
-rwxr-xr-xext/central-controller-docker/main.sh14
2 files changed, 23 insertions, 7 deletions
diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp
index fd99e0ff..0ab721dc 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<int64_t>();
+ if (hookCount > 0) {
+ notifyNewMember(networkId, memberId);
+ }
}
const uint64_t nwidInt = OSUtils::jsonIntHex(config["nwid"], 0ULL);
diff --git a/ext/central-controller-docker/main.sh b/ext/central-controller-docker/main.sh
index 04778a27..5583b3ad 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