diff --git a/Daemon.cpp b/Daemon.cpp
index 2a32ff04..81bbcdd5 100644
--- a/Daemon.cpp
+++ b/Daemon.cpp
@@ -189,7 +189,6 @@ namespace i2p
std::string family; i2p::config::GetOption("family", family);
i2p::context.SetFamily (family);
- i2p::context.SetFamilyString (family);
if (family.length () > 0)
LogPrint(eLogInfo, "Daemon: family set to ", family);
diff --git a/HTTPServer.cpp b/HTTPServer.cpp
index 08b67e22..458a717f 100644
--- a/HTTPServer.cpp
+++ b/HTTPServer.cpp
@@ -417,7 +417,9 @@ namespace util
default: s << "Unknown";
}
s << "
\r\n";
- s << "Family: " << i2p::context.GetFamilyString() << "
\r\n";
+ auto family = i2p::context.GetFamily ();
+ if (family.length () > 0)
+ s << "Family: " << family << "
\r\n";
s << "Tunnel creation success rate: " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%
\r\n";
s << "Received: ";
s << std::fixed << std::setprecision(2);
diff --git a/RouterContext.cpp b/RouterContext.cpp
index 29891169..5fa32a13 100644
--- a/RouterContext.cpp
+++ b/RouterContext.cpp
@@ -149,17 +149,9 @@ namespace i2p
UpdateRouterInfo ();
}
- void RouterContext::SetFamilyString (const std::string& family)
+ std::string RouterContext::GetFamily () const
{
- if (family.length() > 0)
- m_FamilyString = family;
- else
- m_FamilyString = "<undefined>";
- }
-
- std::string RouterContext::GetFamilyString () const
- {
- return m_FamilyString;
+ return m_RouterInfo.GetProperty (i2p::data::ROUTER_INFO_PROPERTY_FAMILY);
}
void RouterContext::SetFamily (const std::string& family)
diff --git a/RouterContext.h b/RouterContext.h
index def89383..5a72ad58 100644
--- a/RouterContext.h
+++ b/RouterContext.h
@@ -59,8 +59,7 @@ namespace i2p
bool IsFloodfill () const { return m_IsFloodfill; };
void SetFloodfill (bool floodfill);
void SetFamily (const std::string& family);
- void SetFamilyString (const std::string& family);
- std::string GetFamilyString () const;
+ std::string GetFamily () const;
void SetBandwidth (int limit); /* in kilobytes */
void SetBandwidth (char L); /* by letter */
bool AcceptsTunnels () const { return m_AcceptsTunnels; };
@@ -102,7 +101,6 @@ namespace i2p
i2p::data::PrivateKeys m_Keys;
uint64_t m_LastUpdateTime;
bool m_AcceptsTunnels, m_IsFloodfill;
- std::string m_FamilyString;
uint64_t m_StartupTime; // in seconds since epoch
uint32_t m_BandwidthLimit; // allowed bandwidth
RouterStatus m_Status;
diff --git a/RouterInfo.cpp b/RouterInfo.cpp
index c27f8754..2e76127c 100644
--- a/RouterInfo.cpp
+++ b/RouterInfo.cpp
@@ -636,6 +636,14 @@ namespace data
m_Properties.erase (key);
}
+ std::string RouterInfo::GetProperty (const std::string& key) const
+ {
+ auto it = m_Properties.find (key);
+ if (it != m_Properties.end ())
+ return it->second;
+ return "";
+ }
+
bool RouterInfo::IsNTCP (bool v4only) const
{
if (v4only)
diff --git a/RouterInfo.h b/RouterInfo.h
index c9881dd2..a55924a8 100644
--- a/RouterInfo.h
+++ b/RouterInfo.h
@@ -128,6 +128,7 @@ namespace data
bool RemoveIntroducer (const boost::asio::ip::udp::endpoint& e);
void SetProperty (const std::string& key, const std::string& value); // called from RouterContext only
void DeleteProperty (const std::string& key); // called from RouterContext only
+ std::string GetProperty (const std::string& key) const; // called from RouterContext only
void ClearProperties () { m_Properties.clear (); };
bool IsFloodfill () const { return m_Caps & Caps::eFloodfill; };
bool IsReachable () const { return m_Caps & Caps::eReachable; };