From 1b81b85582b8492ccbac25f05628433da5e55e2e Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 19 Jul 2018 18:34:40 +0200 Subject: [PATCH] RedisWriter: dump zone_checksum for endpoints refs #11 --- lib/redis/rediswriter-objects.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/redis/rediswriter-objects.cpp b/lib/redis/rediswriter-objects.cpp index ed4549d98..3f0cdf001 100644 --- a/lib/redis/rediswriter-objects.cpp +++ b/lib/redis/rediswriter-objects.cpp @@ -189,11 +189,21 @@ void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool useTran checkSums->Set("name_checksum", CalculateCheckSumString(object->GetShortName())); checkSums->Set("environment_checksum", CalculateCheckSumString(GetEnvironment())); - /* 'zone' is available for all config objects, therefore calculate the checksum. */ - Zone::Ptr zone = static_pointer_cast(object->GetZone()); + auto endpoint (dynamic_pointer_cast(object)); - if (zone) - checkSums->Set("zone_checksum", GetIdentifier(zone)); + if (endpoint) { + auto endpointZone (endpoint->GetZone()); + + if (endpointZone) { + checkSums->Set("zone_checksum", GetIdentifier(endpointZone)); + } + } else { + /* 'zone' is available for all config objects, therefore calculate the checksum. */ + auto zone (dynamic_pointer_cast(object->GetZone())); + + if (zone) + checkSums->Set("zone_checksum", GetIdentifier(zone)); + } User::Ptr user = dynamic_pointer_cast(object);