mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
request lease's gateway if not found in the netDb
This commit is contained in:
parent
bb2fcbf668
commit
f763fd3268
12
LeaseSet.cpp
12
LeaseSet.cpp
@ -3,6 +3,7 @@
|
|||||||
#include "CryptoConst.h"
|
#include "CryptoConst.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
|
#include "NetDb.h"
|
||||||
#include "LeaseSet.h"
|
#include "LeaseSet.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
@ -28,6 +29,7 @@ namespace data
|
|||||||
memcpy (m_EncryptionKey, header->encryptionKey, 256);
|
memcpy (m_EncryptionKey, header->encryptionKey, 256);
|
||||||
LogPrint ("LeaseSet num=", (int)header->num);
|
LogPrint ("LeaseSet num=", (int)header->num);
|
||||||
|
|
||||||
|
// process leases
|
||||||
const uint8_t * leases = buf + sizeof (H);
|
const uint8_t * leases = buf + sizeof (H);
|
||||||
for (int i = 0; i < header->num; i++)
|
for (int i = 0; i < header->num; i++)
|
||||||
{
|
{
|
||||||
@ -36,8 +38,16 @@ namespace data
|
|||||||
lease.endDate = be64toh (lease.endDate);
|
lease.endDate = be64toh (lease.endDate);
|
||||||
m_Leases.push_back (lease);
|
m_Leases.push_back (lease);
|
||||||
leases += sizeof (Lease);
|
leases += sizeof (Lease);
|
||||||
}
|
|
||||||
|
|
||||||
|
// check if lease's gateway is in our netDb
|
||||||
|
if (!netdb.FindRouter (lease.tunnelGateway))
|
||||||
|
{
|
||||||
|
// if not found request it
|
||||||
|
LogPrint ("Lease's tunnel gateway not found. Requested");
|
||||||
|
netdb.RequestDestination (lease.tunnelGateway);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
CryptoPP::DSA::PublicKey pubKey;
|
CryptoPP::DSA::PublicKey pubKey;
|
||||||
pubKey.Initialize (i2p::crypto::dsap, i2p::crypto::dsaq, i2p::crypto::dsag,
|
pubKey.Initialize (i2p::crypto::dsap, i2p::crypto::dsaq, i2p::crypto::dsag,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user