mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
specify and check netId
This commit is contained in:
parent
2a4d78d9bf
commit
0ca3fb5af0
19
NetDb.cpp
19
NetDb.cpp
|
@ -168,16 +168,19 @@ namespace data
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase32());
|
|
||||||
r = std::make_shared<RouterInfo> (buf, len);
|
r = std::make_shared<RouterInfo> (buf, len);
|
||||||
|
if (!r->IsUnreachable ())
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_RouterInfosMutex);
|
LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase32());
|
||||||
m_RouterInfos[r->GetIdentHash ()] = r;
|
{
|
||||||
}
|
std::unique_lock<std::mutex> l(m_RouterInfosMutex);
|
||||||
if (r->IsFloodfill ())
|
m_RouterInfos[r->GetIdentHash ()] = r;
|
||||||
{
|
}
|
||||||
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
if (r->IsFloodfill ())
|
||||||
m_Floodfills.push_back (r);
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
||||||
|
m_Floodfills.push_back (r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// take care about requested destination
|
// take care about requested destination
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace i2p
|
||||||
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable |
|
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable |
|
||||||
i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC
|
i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC
|
||||||
routerInfo.SetProperty ("coreVersion", I2P_VERSION);
|
routerInfo.SetProperty ("coreVersion", I2P_VERSION);
|
||||||
routerInfo.SetProperty ("netId", "2");
|
routerInfo.SetProperty ("netId", std::to_string (I2PD_NET_ID));
|
||||||
routerInfo.SetProperty ("router.version", I2P_VERSION);
|
routerInfo.SetProperty ("router.version", I2P_VERSION);
|
||||||
routerInfo.SetProperty ("stat_uptime", "90m");
|
routerInfo.SetProperty ("stat_uptime", "90m");
|
||||||
routerInfo.CreateBuffer (m_Keys);
|
routerInfo.CreateBuffer (m_Keys);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "I2PEndian.h"
|
#include "I2PEndian.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include "version.h"
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
|
@ -243,6 +244,12 @@ namespace data
|
||||||
// extract caps
|
// extract caps
|
||||||
if (!strcmp (key, "caps"))
|
if (!strcmp (key, "caps"))
|
||||||
ExtractCaps (value);
|
ExtractCaps (value);
|
||||||
|
// check netId
|
||||||
|
if (!strcmp (key, "netId") && atoi (value) != I2PD_NET_ID)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Unexpected netid=", value);
|
||||||
|
m_IsUnreachable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_SupportedTransports || !m_Addresses.size() || (UsesIntroducer () && !introducers))
|
if (!m_SupportedTransports || !m_Addresses.size() || (UsesIntroducer () && !introducers))
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#define I2PD_VERSION_PATCH 0
|
#define I2PD_VERSION_PATCH 0
|
||||||
#define I2PD_VERSION MAKE_VERSION(I2PD_VERSION_MAJOR, I2PD_VERSION_MINOR, I2PD_VERSION_MICRO)
|
#define I2PD_VERSION MAKE_VERSION(I2PD_VERSION_MAJOR, I2PD_VERSION_MINOR, I2PD_VERSION_MICRO)
|
||||||
#define VERSION I2PD_VERSION
|
#define VERSION I2PD_VERSION
|
||||||
|
#define I2PD_NET_ID 2
|
||||||
|
|
||||||
#define I2P_VERSION_MAJOR 0
|
#define I2P_VERSION_MAJOR 0
|
||||||
#define I2P_VERSION_MINOR 9
|
#define I2P_VERSION_MINOR 9
|
||||||
|
|
Loading…
Reference in a new issue