pht: use const reference for IndexEntry::TYPE

Prevents static initialization order issue
This commit is contained in:
Adrien Béraud authored and Adrien Béraud committed 2025-09-22 14:41:22 -04:00
1 parent 3639d651a2
commit d12f9271b8
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -266,7 +266,7 @@ private:
using Value = std::pair<InfoHash, dht::Value::Id>;
struct OPENDHT_PUBLIC IndexEntry : public dht::Value::Serializable<IndexEntry> {
static const ValueType TYPE;
static const ValueType& TYPE;
virtual void unpackValue(const dht::Value& v) {
Serializable<IndexEntry>::unpackValue(v);
+1 -1
View File
@@ -145,7 +145,7 @@ int Pht::Cache::lookup(const Prefix& p) {
return pos;
}
const ValueType IndexEntry::TYPE = ValueType::USER_DATA;
const ValueType& IndexEntry::TYPE = ValueType::USER_DATA;
constexpr std::chrono::minutes Pht::Cache::NODE_EXPIRE_TIME;
void Pht::lookupStep(Prefix p, std::shared_ptr<int> lo, std::shared_ptr<int> hi,