void DbConnection::UpdateObject(const ConfigObject::Ptr& object) { if (!GetConnected() || Application::IsShuttingDown()) return; DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object); if (dbobj) { bool dbActive = GetObjectActive(dbobj); bool active = object->IsActive(); if (active) { if (!dbActive) ActivateObject(dbobj); Dictionary::Ptr configFields = dbobj->GetConfigFields(); String configHash = dbobj->CalculateConfigHash(configFields); ASSERT(configHash.GetLength() <= 64); configFields->Set("config_hash", configHash); String cachedHash = GetConfigHash(dbobj); if (cachedHash != configHash) { dbobj->SendConfigUpdateHeavy(configFields); dbobj->SendStatusUpdate(); } else { dbobj->SendConfigUpdateLight(); } } else if (!active) { /* Deactivate the deleted object no matter * which state it had in the database. */ DeactivateObject(dbobj); } } }