mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-25 23:44:18 +00:00
don't publish LeaseSet without tunnels
This commit is contained in:
parent
823b499a02
commit
51ef7ef61c
@ -300,7 +300,11 @@ namespace client
|
|||||||
{
|
{
|
||||||
int numTunnels = m_Pool->GetNumInboundTunnels () + 2; // 2 backup tunnels
|
int numTunnels = m_Pool->GetNumInboundTunnels () + 2; // 2 backup tunnels
|
||||||
if (numTunnels > i2p::data::MAX_NUM_LEASES) numTunnels = i2p::data::MAX_NUM_LEASES; // 16 tunnels maximum
|
if (numTunnels > i2p::data::MAX_NUM_LEASES) numTunnels = i2p::data::MAX_NUM_LEASES; // 16 tunnels maximum
|
||||||
CreateNewLeaseSet (m_Pool->GetInboundTunnels (numTunnels));
|
auto tunnels = m_Pool->GetInboundTunnels (numTunnels);
|
||||||
|
if (!tunnels.empty ())
|
||||||
|
CreateNewLeaseSet (tunnels);
|
||||||
|
else
|
||||||
|
LogPrint (eLogInfo, "Destination: No inbound tunnels for LeaseSet");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LeaseSetDestination::SubmitSessionKey (const uint8_t * key, const uint8_t * tag)
|
bool LeaseSetDestination::SubmitSessionKey (const uint8_t * key, const uint8_t * tag)
|
||||||
@ -1176,7 +1180,7 @@ namespace client
|
|||||||
LogPrint(eLogError, "Destinations: Can't save keys to ", path);
|
LogPrint(eLogError, "Destinations: Can't save keys to ", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDestination::CreateNewLeaseSet (std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels)
|
void ClientDestination::CreateNewLeaseSet (const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels)
|
||||||
{
|
{
|
||||||
std::shared_ptr<i2p::data::LocalLeaseSet> leaseSet;
|
std::shared_ptr<i2p::data::LocalLeaseSet> leaseSet;
|
||||||
if (GetLeaseSetType () == i2p::data::NETDB_STORE_TYPE_LEASESET)
|
if (GetLeaseSetType () == i2p::data::NETDB_STORE_TYPE_LEASESET)
|
||||||
|
@ -152,7 +152,7 @@ namespace client
|
|||||||
virtual void CleanupDestination () {}; // additional clean up in derived classes
|
virtual void CleanupDestination () {}; // additional clean up in derived classes
|
||||||
// I2CP
|
// I2CP
|
||||||
virtual void HandleDataMessage (const uint8_t * buf, size_t len) = 0;
|
virtual void HandleDataMessage (const uint8_t * buf, size_t len) = 0;
|
||||||
virtual void CreateNewLeaseSet (std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels) = 0;
|
virtual void CreateNewLeaseSet (const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ namespace client
|
|||||||
void CleanupDestination ();
|
void CleanupDestination ();
|
||||||
// I2CP
|
// I2CP
|
||||||
void HandleDataMessage (const uint8_t * buf, size_t len);
|
void HandleDataMessage (const uint8_t * buf, size_t len);
|
||||||
void CreateNewLeaseSet (std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels);
|
void CreateNewLeaseSet (const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@ namespace data
|
|||||||
}
|
}
|
||||||
|
|
||||||
LocalLeaseSet2::LocalLeaseSet2 (uint8_t storeType, const i2p::data::PrivateKeys& keys,
|
LocalLeaseSet2::LocalLeaseSet2 (uint8_t storeType, const i2p::data::PrivateKeys& keys,
|
||||||
const KeySections& encryptionKeys, std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels,
|
const KeySections& encryptionKeys, const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels,
|
||||||
bool isPublic, bool isPublishedEncrypted):
|
bool isPublic, bool isPublishedEncrypted):
|
||||||
LocalLeaseSet (keys.GetPublic (), nullptr, 0)
|
LocalLeaseSet (keys.GetPublic (), nullptr, 0)
|
||||||
{
|
{
|
||||||
|
@ -251,7 +251,7 @@ namespace data
|
|||||||
|
|
||||||
LocalLeaseSet2 (uint8_t storeType, const i2p::data::PrivateKeys& keys,
|
LocalLeaseSet2 (uint8_t storeType, const i2p::data::PrivateKeys& keys,
|
||||||
const KeySections& encryptionKeys,
|
const KeySections& encryptionKeys,
|
||||||
std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels,
|
const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels,
|
||||||
bool isPublic, bool isPublishedEncrypted = false);
|
bool isPublic, bool isPublishedEncrypted = false);
|
||||||
|
|
||||||
LocalLeaseSet2 (uint8_t storeType, std::shared_ptr<const IdentityEx> identity, const uint8_t * buf, size_t len); // from I2CP
|
LocalLeaseSet2 (uint8_t storeType, std::shared_ptr<const IdentityEx> identity, const uint8_t * buf, size_t len); // from I2CP
|
||||||
|
@ -84,7 +84,7 @@ namespace client
|
|||||||
m_Owner->SendMessagePayloadMessage (buf + 4, length);
|
m_Owner->SendMessagePayloadMessage (buf + 4, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2CPDestination::CreateNewLeaseSet (std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels)
|
void I2CPDestination::CreateNewLeaseSet (const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels)
|
||||||
{
|
{
|
||||||
GetService ().post (std::bind (&I2CPDestination::PostCreateNewLeaseSet, this, tunnels));
|
GetService ().post (std::bind (&I2CPDestination::PostCreateNewLeaseSet, this, tunnels));
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ namespace client
|
|||||||
|
|
||||||
// I2CP
|
// I2CP
|
||||||
void HandleDataMessage (const uint8_t * buf, size_t len);
|
void HandleDataMessage (const uint8_t * buf, size_t len);
|
||||||
void CreateNewLeaseSet (std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> > tunnels);
|
void CreateNewLeaseSet (const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user