Skip to content

Commit 0b32ea8

Browse files
committed
ApiListener#RelayMessageOne(): log to which Endpoint messages are relayed
if they're for our parent Zone.
1 parent 0613381 commit 0b32ea8

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/remote/apilistener.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -1220,11 +1220,12 @@ bool ApiListener::RelayMessageOne(const Zone::Ptr& targetZone, const MessageOrig
12201220
ASSERT(targetZone);
12211221

12221222
Zone::Ptr localZone = Zone::GetLocalZone();
1223+
auto parentZone (localZone->GetParent());
12231224

12241225
/* only relay the message to a) the same local zone, b) the parent zone and c) direct child zones. Exception is a global zone. */
12251226
if (!targetZone->GetGlobal() &&
12261227
targetZone != localZone &&
1227-
targetZone != localZone->GetParent() &&
1228+
targetZone != parentZone &&
12281229
targetZone->GetParent() != localZone) {
12291230
return true;
12301231
}
@@ -1303,12 +1304,26 @@ bool ApiListener::RelayMessageOne(const Zone::Ptr& targetZone, const MessageOrig
13031304
bool isMaster = (currentZoneMaster == localEndpoint);
13041305

13051306
if (!isMaster && targetEndpoint != currentZoneMaster) {
1307+
if (currentTargetZone == parentZone) {
1308+
if (m_CurrentParentEndpoint.exchange(currentZoneMaster.get()) != currentZoneMaster.get()) {
1309+
Log(LogInformation, "ApiListener") << "Relaying messages for parent Zone '"
1310+
<< parentZone->GetName() << "' to Endpoint '" << currentZoneMaster->GetName() << "'";
1311+
}
1312+
}
1313+
13061314
skippedEndpoints.push_back(targetEndpoint);
13071315
continue;
13081316
}
13091317

13101318
relayed = true;
13111319

1320+
if (currentTargetZone == parentZone) {
1321+
if (m_CurrentParentEndpoint.exchange(targetEndpoint.get()) != targetEndpoint.get()) {
1322+
Log(LogInformation, "ApiListener") << "Relaying messages for parent Zone '"
1323+
<< parentZone->GetName() << "' to Endpoint '" << targetEndpoint->GetName() << "'";
1324+
}
1325+
}
1326+
13121327
SyncSendMessage(targetEndpoint, message);
13131328
}
13141329

lib/remote/apilistener.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "remote/httpserverconnection.hpp"
99
#include "remote/endpoint.hpp"
1010
#include "remote/messageorigin.hpp"
11+
#include "base/atomic.hpp"
1112
#include "base/configobject.hpp"
1213
#include "base/process.hpp"
1314
#include "base/shared.hpp"
@@ -177,6 +178,7 @@ class ApiListener final : public ObjectImpl<ApiListener>
177178
Timer::Ptr m_RenewOwnCertTimer;
178179

179180
Endpoint::Ptr m_LocalEndpoint;
181+
Atomic<Endpoint*> m_CurrentParentEndpoint {nullptr};
180182

181183
static ApiListener::Ptr m_Instance;
182184
static std::atomic<bool> m_UpdatedObjectAuthority;

0 commit comments

Comments
 (0)