Fix cluster crash w/ config sync

refs #5212
This commit is contained in:
Michael Friedrich 2017-05-12 10:48:11 +02:00
parent 09a1d4f756
commit 3753f53a67
3 changed files with 19 additions and 2 deletions

View File

@ -283,8 +283,8 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const D
} }
Log(LogInformation, "ApiListener") Log(LogInformation, "ApiListener")
<< "Applying config update from endpoint '" << origin->FromClient->GetEndpoint()->GetName() << "' of zone '" << "Applying config update from endpoint '" << origin->FromClient->GetEndpoint()->GetName()
<< origin->FromZone->GetName() << "'"; << "' of zone '" << GetFromZoneName(origin->FromZone) << "'.";
Dictionary::Ptr updateV1 = params->Get("update"); Dictionary::Ptr updateV1 = params->Get("update");
Dictionary::Ptr updateV2 = params->Get("update_v2"); Dictionary::Ptr updateV2 = params->Get("update_v2");

View File

@ -1245,3 +1245,19 @@ bool ApiListener::IsHACluster(void)
return zone->IsSingleInstance(); return zone->IsSingleInstance();
} }
/* Provide a helper function for zone origin name. */
String ApiListener::GetFromZoneName(const Zone::Ptr& fromZone)
{
String fromZoneName;
if (fromZone) {
fromZoneName = fromZone->GetName();
} else {
Zone::Ptr lzone = Zone::GetLocalZone();
if (lzone)
fromZoneName = lzone->GetName();
}
return fromZoneName;
}

View File

@ -99,6 +99,7 @@ public:
static void UpdateObjectAuthority(void); static void UpdateObjectAuthority(void);
static bool IsHACluster(void); static bool IsHACluster(void);
static String GetFromZoneName(const Zone::Ptr& fromZone);
protected: protected:
virtual void OnConfigLoaded(void) override; virtual void OnConfigLoaded(void) override;